Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1.Create an enum 2. Create a static member variable in this enum but do not initialize it 3. Initialize the static member in the private constructor. It's not working even if every compilance-setting is set at least to "warning". More information: See the example file Status.java attached. It's compiled on the commando line as well as on Eclipse 3.3
Created attachment 106301 [details] Testcase-Example This file is compile on the commando line without any problems. With Eclipse 3.3 it's compiled as well, With Eclipse 3.4, unfortunately, a Compiler Error arises even if every JDK Compilance setting is set at most to "Warning"
This is the expected behavior. Basically, we were missing to detect an error in 3.3.2, this was signaled as bug 228109, and fixed for 3.4RC1. So in essence, this is invalid code which we used to accept by mistake. Marking as invalid, since this is the expected behavior.
Added GenericTypeTest#test1364
Actually, regression tests are EnumTest#test162-163. Note that the following would work fine: --------------------------------------- import java.util.HashMap; import java.util.Map; enum Status { GOOD((byte) 0x00), BAD((byte) 0x02); private byte value; private static Map<Byte, Status> mapping; private Status(final byte newValue) { this.value = newValue; } static { Status.mapping = new HashMap<Byte, Status>(); for (Status s : values()) { Status.mapping.put(s.value, s); } } }
Verified for 3.5M1 using I20080805-1307