I just got Java5 project that has this error, i tried using Java5 and Java6, but its still there. it worked somehow before(since it was in svn), how can i bypass that compil
Another way to "bypass" it, if you need for example a counter or something that needs to run on each initalization, is to create a private static inner class, like so:
public enum Foo {
BAR, BAZ;
private static final class StaticFields {
private static final Map lowerCaseMap = new HashMap<>();
private static int COUNTER = 0;
}
private Foo() {
StaticFields.lowerCaseMap.put(this.name().toLowerCase(), this);
StaticFields.COUNTER++;
}
}