-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Prevent extending java.lang.Enum except from an enum #7499
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
Labels
Comments
Linking for reference - #7174 |
TheElectronWill
added a commit
to TheElectronWill/dotty
that referenced
this issue
Aug 3, 2020
TheElectronWill
added a commit
to TheElectronWill/dotty
that referenced
this issue
Aug 3, 2020
TheElectronWill
added a commit
to TheElectronWill/dotty
that referenced
this issue
Aug 7, 2020
TheElectronWill
added a commit
that referenced
this issue
Aug 7, 2020
Fix #7499: Prevent extending java.lang.Enum except from an enum
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
as detailed in lampepfl/dotty-feature-requests#73, extending
java.lang.Enum
from a class is forbidden in Java, as Java enums are only guaranteed typesafe when created from its enum construct, additionally, thesuper
call tojava/lang/Enum."<init>":(Ljava/lang/String;I)V
is synthesised byjavac
and the constructor is not exposed to Java source programs.We should do the same in Dotty - extending
java.lang.Enum
should not be permitted apart from in anenum
.We should also support the old scala 2 way of extending
java.lang.Enum
with3.0-migration
The text was updated successfully, but these errors were encountered: