Broken enum produce inconvenient errors and AST

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 14
    • Affects Version/s: 14
    • Component/s: tools
    • None
    • b10

      Consider this input code:
      ---
      public enum BrokenEnum {
          A,
          void t() {}
          B;
      }
      ---

      When compiled, this leads to these errors:
      ---
      $ javac BrokenEnum.java
      BrokenEnum.java:2: error: <identifier> expected
          A,
            ^
      BrokenEnum.java:3: error: ',', '}', or ';' expected
          void t() {}
          ^
      BrokenEnum.java:3: error: '}' expected
          void t() {}
              ^
      BrokenEnum.java:5: error: class, interface, or enum expected
      }
      ^
      4 errors
      ---

      And the AST is:
      ---
      public enum BrokenEnum {
          /*public static final*/ A /* = new BrokenEnum() */ /*enum*/ ,
          /*public static final*/ <error> /* = new BrokenEnum() */ /*enum*/ ;
          (ERROR)
      }(ERROR)
      ---

      Both of these are fairly inconvenient.

            Assignee:
            Jan Lahoda
            Reporter:
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: