-
Notifications
You must be signed in to change notification settings - Fork 1.1k
No Java generic signatures generated for static forwarders in companions of objects for vals and paramless defs #10347
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
It's because we don't generate Java generic signatures on the static forwarders we create in a class for each method in the corresponding companion object, minimized: object A {
def foo: List[String] = Nil
} Compiled with Scala 2: # javap -p -v 'A$.class'
...
public scala.collection.immutable.List<java.lang.String> foo(); # javap -p -v 'A.class'
...
public static scala.collection.immutable.List<java.lang.String> foo(); Compiled with Dotty: # javap -p -v 'A$.class'
...
public scala.collection.immutable.List<java.lang.String> foo(); # javap -p -v 'A.class'
...
public static scala.collection.immutable.List foo(); // <-- no type parameter info |
Workaround: add parens to the method, then the correct signature gets generated: object A {
def foo(): List[String] = Nil
} |
Is this related to #8631? |
Yep same issue |
@smarter the issue here is that is that the nullary method has an Then this test fails ( Do you have a suggestion how to fix this? |
seems like we should use TypeErasure.transformInfo (or directly TypeErasure#eraseInfo) instead of fullErasure. |
👍 thanks! |
Minimized code
Output
Expectation
Fails with latest
3.0.0-M2-bin-20201115-3c04f9b-NIGHTLY
and3.0.0-M1
. While this succeeds with scala 2.13.3.The text was updated successfully, but these errors were encountered: