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
packagetest;
public classTest {
public static void main(String[] args) {
Bar bar =newBar().qux();
Duh duh =newDuh().qux();
System.out.println(bar);
System.out.println(duh);
}
}
Then the scala side Test2 will compile without problem and run while the java side will generate an error
C:\scala-2.10.0-M6\recurse>javac -d . -cp .;..\lib\scala-library.jar *.java
Test.java:6: incompatible types
found : test.Foo
required: test.Bar
Bar bar = new Bar().qux();
^
Test.java:7: incompatible types
found : test.Foo
required: test.Duh
Duh duh = new Duh().qux();
^
2 errors
A workaround is to either cast it on the java side to the proper type like Duh or override the method in the concrete class to return a concrete type like Bar.
@lrytz said:
I think it's not related to #5289. That one is about static forwarders generated for scala modules. The one here is about types, possibly signatures, but the Java code does not use static forwarders.
Consider a recursive type definition on the scala side and Test on the java side and a Test2 on the scala side.
recurse.scala
and
Test.java
Then the scala side Test2 will compile without problem and run while the java side will generate an error
A workaround is to either cast it on the java side to the proper type like Duh or override the method in the concrete class to return a concrete type like Bar.
recurse.scala
and
Test.java
see thread
https://groups.google.com/forum/?hl=en&fromgroups#!topic/scala-user/PPDIPfeKGzo%5B1-25%5D
The text was updated successfully, but these errors were encountered: