-
Notifications
You must be signed in to change notification settings - Fork 21
Scala class inheriting a Java class and overriding method with inner class parameter #3120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3120?orig=1 |
@paulp said: public class J1 {
public class Inner1 { }
public static class Inner2 { }
}
public class J2 {
public void f1(J1.Inner1 p) { }
public void f2(J1.Inner2 p) { }
}
public class Q {
public void passInner(J1.Inner1 myInner) {}
} When scala parses the method signatures in J2, it treats them as member selections. In scala we write J1.Inner1 for the static version and J1#Inner1 for the instance, but java offers no such crutch. The reason I couldn't dash off an easy fix is that at the parsing stage it doesn't yet know which it is. In JavaParsers I could do this: - Select(qual, name.toTypeName)
+ SelectFromTypeTree(convertToTypeId(qual), name.toTypeName) and in fact that fixes this bug, but then breaks anything that needed the guess to go the other way. So I will need some input on how to defer it long enough to obtain the type information. |
@odersky said: |
Erik Bruchez (ebruchez) said: |
Uh oh!
There was an error while loading. Please reload this page.
I have this Java class with inner class:
MyClassWithInner.java:
Then another Java class using MyInnerClass:
MyBaseJavaClass.java:
Finally, this Scala class:
MyDerivedScalaClass.scala:
Compiling:
Same result with 2.7.7 and 2.8.0.Beta1.
See this discussion:
http://comments.gmane.org/gmane.comp.lang.scala.user/24133
The text was updated successfully, but these errors were encountered: