-
Notifications
You must be signed in to change notification settings - Fork 21
Mixed (java-scala) compilation fails, separate works due to import ambiguity #9111
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-9111?orig=1 |
@lrytz said: |
@lrytz said: |
scala/scala#5606 looked promising, but didn't make it across the finish line |
This issue is impacting users of the latest version of protocol buffers (3.8.0). This version of protoc generates the following code:
As a workaround I added |
Update: the workaround does not work for Scala 2.11 - so for the time being we can't upgrade to protobuf 3.8.0. |
scalacOptions in (Compile, doc) ++= if (scalaBinaryVersion.value == "2.11") Nil else List("-no-java-comments") |
@retronym thanks, that works. I missed the fact that the failure for <2.12 is due to the option not being supported. I'm satisfied with this workaround. |
BTW, this bug is fixed in 2.13.0 and will also be in the upcoming 2.12.9 release. |
[Error] /home/travis/build/scafi/scafi/simulator-gui-new/src/main/scala/it/unibo/scafi/simulation/s2/frontend/model/simulation/implementation/mutable/StandardNodeDefinition.scala:64: Symbol 'type javafx.scene.control.TabPane.TabDragPolicy' is missing from the classpath. This symbol is required by 'value scalafx.scene.control.TabPane.value'. Make sure that type TabDragPolicy is in your classpath and check for conflicting dependencies with `-Ylog-classpath`. A full rebuild may help if 'TabPane.class' was compiled against an incompatible version of javafx.scene.control.TabPane. [Error] : Error while emitting it/unibo/scafi/simulation/s2/frontend/view/scalaFX/logger/FXLogger Failed to get the type of class symbol javafx.scene.control.TabPane$TabDragPolicy due to scala/bug#9111. 48 warnings found two errors found
- Resolves #522 - See: scala/bug#9111 (comment)
- Resolves #522 - See: scala/bug#9111 (comment)
- Resolves #522 - See: scala/bug#9111 (comment) - Update README doc links
Very similar to #2377 (which is fixed).
Java file:
Scala file:
Mixed compilation:
the reason is Scalac's desugaring which introduces an import:
separate compilation (java first) works
Even worse: instead of an ambiguity, the Scala compiler resolves types in Java signatures incorrectly:
A.java
Test.scala
Mixed compilation works, but runtime fails. Seperate compilation fails (correctly):
In this example, the Scala compiler does not inject any
import Inner._
. The Java parser checks if there are any statics in the class. If not, it doesn't add the import. This is wrong because statics may be inherited.The text was updated successfully, but these errors were encountered: