-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix JavaMethodType creation and parameter matching of JavaMethodTypes #345
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
Conversation
17424b1
to
03a37a5
Compare
Scalac converts Object to Any in both UnPickler (for .class inputs) and in Namers (for Java source inputs): val makeMethodType = (vparams: List[Symbol], restpe: Type) => {
// TODODEPMET: check that we actually don't need to do anything here
// new dependent method types: probably OK already, since 'enterValueParams' above
// enters them in scope, and all have a lazy type. so they may depend on other params. but: need to
// check that params only depend on ones in earlier sections, not the same. (done by checkDependencies,
// so re-use / adapt that)
if (meth.isJavaDefined)
// TODODEPMET necessary?? new dependent types: replace symbols in restpe with the ones in vparams
JavaMethodType(vparams map (p => p setInfo objToAny(p.tpe)), restpe)
else
MethodType(vparams, restpe)
} Dotty does it only in UnPickler, but (currently) not in Namer. To be consistent with Scalac, we could additionally do it in Namer, and then revert the change that switched things in matchingParams. Alternatively, we can think about whether in Dotty, we want Java Object to be represented internally as Any or Object. If we decide to keep it as Object, then we would need to remove the conversion from UnPickler for consistency. |
Ah I see. I think dotty needs to behave like scalac here. The problem is On Sun, Feb 1, 2015 at 8:52 AM, Ondřej Lhoták [email protected]
Martin Odersky |
03a37a5
to
e4d9032
Compare
I have updated the fix to be like scalac: Namer converts Object parameters in Java methods to Any. The switch in I have some concern over the destructive update of |
e4d9032
to
d9a013c
Compare
… Any Fixes two bugs needed for java-override test: Namer was creating a MethodType instead of a JavaMethodType even though the JavaDefined flag was set on the DefDef. Following Scalac, Namer needs to convert Java method parameters of type j.l.Object to s.Any.
d9a013c
to
4316f94
Compare
Rebased to current master. |
Fix JavaMethodType creation and parameter matching of JavaMethodTypes
Backport "Mix in the `productPrefix` hash statically in case class `hashCode`" to 3.3 LTS
Based on #339.
Fixes java-override test.
The Java method did have a JavaDefined flag.
The bugs were: