JDK-5009574 : Compiler should prohibit extending java.lang.Enum
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.0,5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2004-03-08
  • Updated: 2004-04-01
  • Resolved: 2004-04-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b46Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
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); }
}

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b46 tiger-beta2
14-06-2004

PUBLIC COMMENTS ...
10-06-2004

SUGGESTED FIX See changes in 5009601. ###@###.### 2004-03-29
29-03-2004

EVALUATION This rule remains in the latest "preliminary proposed final draft 2" (section III, second sentence) and so should be implemented in javac. ###@###.### 2004-03-08
08-03-2004