-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Java imports of Scala symbols with trailing $
not inferred
#13662
Comments
$
not inferred$
not inferred
This occurs because of the Scala name mangling. The Java reference to |
Unfortunately, the name mangling is not officially documented and is implementation-specific and so can (and has) changed between scalac versions. https://github.com/travisbrown/scala-java-interop/blob/master/src/main/java/demo/UsingScala.java provides examples of the name mangling that we could refer to. Is this worth even doing? If users are importing Scala code into Java files, maybe we should punt and they will have to add explicit dependencies? |
|
…code (#13696) As described in #13662, Java code that tries to import Scala symbols is not having that dependency inferred by Pants. The cause is that the Scala backend does not expose the transformed names seen by Java code for Scala symbols. For example, the instance for `object Foo` in package `org.pantsbuild.example` is actually `org.pantsbuild.example.Foo$.MODULE$`. This PR is the first step in solving this by generating the transformed names as part of source analysis. Only the `object` case is handled for now. A subsequent PR will use this information for Java dependency inference. [ci skip-rust]
I still have to implement inference in the Python rules using this data. |
The reason is that only the Java rules should consume the mangled names. Scala inference should ignore this data. That seemed like a complicated change so I didn't include that change in #13696. |
This represented roughly 5% of the issues in |
The text was updated successfully, but these errors were encountered: