![]() :34: error: overloaded method value options with alternatives: (options: java.util. src/main/java/net/elehack/argparse4s/ArgConfig. DataFrameReader > cannot be applied to (. We also recommend that you use unique names for private methods in value classes. Public static void setDefault(Argument arg, Object dft)ĭefine a helper class with a method called, and use this Java class from Scala. Change the Scala version to 2.12 and later. This is the method used by mdekstrand / argparse4s, which is a Scala wrapper for argparse4j, but under src/main/java. However, I think that the default value displayed in the help will be as follows.Ĭompromise 3: Write a helper class in Java and use it in Scala However, in Scala, if the parameter types are compatible, you will not be able to resolve which of the overloaded methods you should use and you will get a compile error. With this method, I feel that I can call it with the following code. (The method of calling by reflection is described in the question text, so I excluded it)Ĭompromise 1: Consider using other librariesĬompromise 2: Call the setDefault(E. ![]() In dotty (Scala 3.x), it may be possible in some way (?).įor the time being, there are three possible compromises. Because Array. val bytes Array.ofDimByte (recordSize.toInt) or change recordSize to an Int. Probably, you can't call the setDefault(Object value) method from Scala. To resolve it, you could call Long.toInt like. classOf.getMethod("f", classOf).invoke(x, "foo") // => 2įundamentally, how do you explicitly call the method on the 2. This error is okay except the package 'JavaConversions' is outdate with my Scala version. val x = new X()Įrror: ambiguous reference to overloaded definition,īoth method f in class X of type (value: Any)UnitĪnd method f in class X of type (values: E*)UnitĮven if the parameter part at the time of calling is "foo":Object or "foo".asInstanceOf, the situation does not change. to use another overloaded toMap() method also accepts an argument to resolve. ![]() However, in Scala, if the parameter types are compatible, you will not be able to resolve which of the overloaded methods you should use and you will get a compile error. The collect() method of Stream class can be used to accumulate elements of. I'm trying to use the overloaded methods provided by the Java library in Scala. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |