Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Dec 25, 2023

Java can refer to a Scala object Module as Module$.MODULE$, which is of runtime type Module$.

However, in mixed compilation, Scalac does not understand Module$ as a type written in Java, which is Module.type in Scala. This commit allows Scala to accept the notation in Java sources.

Fixes scala/bug#9714

@scala-jenkins scala-jenkins added this to the 2.13.14 milestone Dec 25, 2023
@som-snytt som-snytt closed this Dec 25, 2023
@som-snytt som-snytt reopened this Dec 26, 2023
@som-snytt som-snytt force-pushed the issue/9714-java-names-singleton branch from e8ac5a8 to 26002ec Compare December 26, 2023 21:24
@som-snytt som-snytt marked this pull request as ready for review December 26, 2023 21:40
@som-snytt som-snytt added the release-notes worth highlighting in next release notes label Dec 28, 2023
@lrytz lrytz force-pushed the issue/9714-java-names-singleton branch from 26002ec to 9710b52 Compare January 4, 2024 15:46
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic! 🎩 🐰

@lrytz lrytz merged commit 98b7789 into scala:2.13.x Jan 5, 2024
@lrytz lrytz modified the milestones: 2.13.14, 2.13.13 Jan 5, 2024
@som-snytt som-snytt deleted the issue/9714-java-names-singleton branch January 5, 2024 17:47
@SethTisue SethTisue changed the title Allow module lookup from Java In mixed compilation, allow Java sources to reference MODULE$ Feb 10, 2024
i10416 added a commit to i10416/dotty that referenced this pull request Feb 25, 2024
bishabosha added a commit to scala/scala3 that referenced this pull request Feb 28, 2024
To find Scala companion mudule from Java, we should strip module suffix
`$`.
This ~provides workaround~ fixes #17255 as well as forward-port
scala/scala#10644. ~, but it requires some
refinment to fix it because not-fully-qualified type like the following
example still fails to compile due to missing symbol.~

Related to scala/scala#10644
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixed compilation: cannot refer to Scala object in Java source
3 participants