Skip to content

Instantly share code, notes, and snippets.

@todesking
Created September 26, 2011 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todesking/1241605 to your computer and use it in GitHub Desktop.
Save todesking/1241605 to your computer and use it in GitHub Desktop.
wtf
public enum A {
Hoge(CONST); // Cannot reference a field before it is defined
private static int CONST = 1;
private A(int x) {
}
}
public enum B { // Syntax error on token "{", ; expected after this token
private static int CONST = 1;
Hoge(CONST);
private B(int x) {
}
}
public enum C { // OK
Hoge(Proxy.CONST);
private static class Proxy {
public static int CONST = 1;
}
private C(int x) {
}
}
public enum D { // OK
Hoge(getConst());
private static int getConst() {
return 1;
}
D(int x) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment