Skip to content

Prevent extending java.lang.Enum except from an enum #7499

@bishabosha

Description

@bishabosha

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, the super call to java/lang/Enum."<init>":(Ljava/lang/String;I)V is synthesised by javac 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 an enum.

We should also support the old scala 2 way of extending java.lang.Enum with 3.0-migration

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions