Community
Participate
Working Groups
When I compile TestEnum.java with javac I get the following error that I don't get from within Eclipse: % javac TestEnum.java TestEnum.java:10: illegal reference to static field from initializer if (someList == null) { ^ TestEnum.java:11: illegal reference to static field from initializer someList = new ArrayList(); ^ 2 errors // Following is TestEnum.java import java.util.ArrayList; public enum TestEnum { one, two; static ArrayList someList; private TestEnum() { if (someList == null) { someList = new ArrayList(); } } }
Added EnumTest#test118 *** This bug has been marked as a duplicate of 101713 ***