Guest User

Untitled

a guest
Jan 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public enum A {
  2. Hoge(CONST); // Cannot reference a field before it is defined
  3. private static int CONST = 1;
  4.  
  5. private A(int x) {
  6. }
  7. }
  8. public enum B { // Syntax error on token "{", ; expected after this token
  9. private static int CONST = 1;
  10. Hoge(CONST);
  11.  
  12. private B(int x) {
  13. }
  14. }
  15. public enum C { // OK
  16. Hoge(Proxy.CONST);
  17.  
  18. private static class Proxy {
  19. public static int CONST = 1;
  20. }
  21.  
  22. private C(int x) {
  23. }
  24. }
  25. public enum D { // OK
  26. Hoge(getConst());
  27.  
  28. private static int getConst() {
  29. return 1;
  30. }
  31.  
  32. D(int x) {
  33. }
  34. }
Add Comment
Please, Sign In to add comment