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

Add mini-phase to fix constructors for enums extending java.lang.Enum #6602

Merged
merged 13 commits into from
Jun 5, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 4, 2019

No description provided.

Miniphase for adding constructor parameters if a Scala enum extends
a Java enum.
Since java.lang.Enum now pretends ot have an empty constructor, Java
trees should not pass any arguments to it either.
Unlike Object, which is the other class we fiddle with, java.lang.Enum
really has a companion object. So we should leave it as it is.
This avoids extensive special casing in Denotations#updateValidity
@odersky
Copy link
Contributor Author

odersky commented Jun 5, 2019

We still get a failure in the community build which is probably unrelated to this PR (the main build fails as well).

EDIT: It is related to this PR. It seems we cannot force java.lang.Enum in Definitions, that's what causes the NPE.

Use scala.compat.JEnum instead of java.lang.Enum to publish a Scala enum
as a Java enum. This avoids having to hijack java.lang.Enums constructor.
The latter leads to problems when compiling the standard 2.13 standard library.
Since java.lang.Enum now pretends ot have an empty constructor, Java
trees should not pass any arguments to it either. (reverted from commit 39e1374)
@odersky odersky removed their assignment Jun 5, 2019
@anatoliykmetyuk anatoliykmetyuk merged commit 9116ecb into scala:master Jun 5, 2019
@anatoliykmetyuk anatoliykmetyuk deleted the add-enum-constrs branch June 5, 2019 12:43
@biboudis biboudis added this to the 0.16 Tech Preview milestone Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants