You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ javap Sub.scala
public classSub implements Super<java.lang.Integer> {
public Sub();
public java.lang.Integer get();
public java.lang.Number get();
}
Expectation
That duplicate 'get' method seems suspicious to me, I had expected:
$ javap Sub.scala
public classSub implements Super<java.lang.Integer> {
public Sub();
public java.lang.Integer get();
}
... however in fact both Scala and Java appear to select the correct method just fine.
Minimized code
Adding static object forwarders to the mix, however:
trait Super[T <: Number]:
def get: T = ???
object Sub extends Super[Integer]:
override def get: Integer = 37
Output
$ javap Sub.class
public final class Sub {
public static java.lang.Integer get();
public static java.lang.Number get();
}
Expectation
Here I expected:
$ javap Sub.class
public final class Sub {
public static java.lang.Integer get();
}
And in this case it actually leads to a problem: while Scala code will not use these forwarders anyway, when using them from Java:
public class Use {
public static void main(String... args) {
System.out.println(Sub.get());
}
}
I get a "reference to get is ambiguous" error from javac (tested with AdoptOpenJDK-11.0.11+9 - interestingly OpenJDK 1.8.0_272-b10 appears to select the right method just fine).
(of course this is a minimized example, but we see this problem when building Akka with Scala 3 and referring to Akka extensions from Java code)
The text was updated successfully, but these errors were encountered:
Problem:
The Scala 3.0.1 compiler includes bugs that are patched
in the 3.0.2-RC1 release. An example of this is the broken
Java APIs in JDK 11 for our `TimeLikeOps` classes because of
scala/scala3#13039.
Result / Solution:
Using the 3.0.2-RC1 release doesn't break any tests and our
projects compile fine. Let's update to this to make use of the bug
fixes until the 3.0.2 is officially released.
The new Dotty scaladoc requires network access due to a bug
scala/scala3#13272. For now let's
disable scaladoc for scala 3.
JIRA Issues: CSL-11235
Differential Revision: https://phabricator.twitter.biz/D720887
Compiler version
3.0.1-RC1
Minimized code
Output (OK?)
Expectation
That duplicate 'get' method seems suspicious to me, I had expected:
... however in fact both Scala and Java appear to select the correct method just fine.
Minimized code
Adding static object forwarders to the mix, however:
Output
Expectation
Here I expected:
And in this case it actually leads to a problem: while Scala code will not use these forwarders anyway, when using them from Java:
I get a "reference to get is ambiguous" error from javac (tested with AdoptOpenJDK-11.0.11+9 - interestingly OpenJDK 1.8.0_272-b10 appears to select the right method just fine).
(of course this is a minimized example, but we see this problem when building Akka with Scala 3 and referring to Akka extensions from Java code)
The text was updated successfully, but these errors were encountered: