Skip to content
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

In mixed compilation, allow Java sources to reference MODULE$ #10644

Merged
merged 1 commit into from Jan 5, 2024

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
3 checks passed
@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
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
3 participants