Bug 110403 - [1.5][compiler] access from initialiser to a static members of an enum should be forbidden
Summary: [1.5][compiler] access from initialiser to a static members of an enum should...
Status: RESOLVED DUPLICATE of bug 101713
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-23 04:07 EDT by Rémi Forax CLA
Modified: 2005-09-26 12:42 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.