Bug 110403

Summary: [1.5][compiler] access from initialiser to a static members of an enum should be forbidden
Product: [Eclipse Project] JDT Reporter: Rémi Forax <forax>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Rémi Forax CLA 2005-09-23 04:07:45 EDT
The JLS 3 (chapter 8 p257) specifies that 
"It is a compile-time error to reference a non-constant (§15.28) static field of
an enum type from its constructors, instance initializer blocks, or instance
variable initializer expressions."

but the following code does compile with eclipse :
enum Foo {
 A(0);
 Foo(int x) {
    t[0]=x;
 }
 private static final int[] t = new int[12];
}

Rémi Forax
Comment 1 Olivier Thomann CLA 2005-09-25 10:28:45 EDT
Closing as dup of bug 101713.
This is fixed in 3.2M1 and in the 3.1 maintenance stream.

*** This bug has been marked as a duplicate of 101713 ***
Comment 2 Olivier Thomann CLA 2005-09-26 12:42:30 EDT
Added regression test in
org.eclipse.jdt.core.tests.compiler.regression.EnumTest.test123.