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

Projects
None yet
3 participants
@odersky
Copy link
Contributor

commented Jun 4, 2019

No description provided.

@odersky odersky requested a review from anatoliykmetyuk Jun 4, 2019

odersky added some commits Jun 4, 2019

Miniphase for adding constructor parameters to Java enums
Miniphase for adding constructor parameters if a Scala enum extends
a Java enum.
Don't pass dummy arguments to java.lang.Enum when parsing Java
Since java.lang.Enum now pretends ot have an empty constructor, Java
trees should not pass any arguments to it either.
Revert special handling of java.lang.Enum's companion object
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.
Make java.lang.Enum a Permanent symbol
This avoids extensive special casing in Denotations#updateValidity

@odersky odersky force-pushed the dotty-staging:add-enum-constrs branch from ce9daa9 to 94e40ae Jun 4, 2019

@odersky

This comment has been minimized.

Copy link
Contributor Author

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.

odersky added some commits Jun 5, 2019

Use scala.compat.JEnum instead of java.lang.Enum
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.
Don't pass dummy arguments to java.lang.Enum when parsing Java
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 lampepfl:master Jun 5, 2019

2 checks passed

CLA User signed CLA
Details
continuous-integration/drone/pr the build was successful
Details

@anatoliykmetyuk anatoliykmetyuk deleted the dotty-staging:add-enum-constrs branch Jun 5, 2019

@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
You can’t perform that action at this time.