The JSR-201 Public Review Draft Spec says that it is illegal for a class to extend java.lang.Enum explicitly but compiler permits it. The following program should generate an compile-time error. In fact it crashes the compiler:
public class Junk extends Enum {
Junk() { super(null, 0); }
}
public class Junk extends Enum {
Junk() { super(null, 0); }
}
- duplicates
-
JDK-5011080 A constructor call to an inner class that extends Enum crashes javac.
- Closed
-
JDK-5011089 javac allows programmer to directly subclass the class 'Enum'.
- Closed
- relates to
-
JDK-5009601 Bring enum implementation up to date with its spec
- Resolved