Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8050019

Better error recovery when parsing enums

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • tools

      Consider the following code:
      ---
      enum Test {
          enum Inner { }
      }
      ---

      Compiling this produces the following errors:
      ---
      E.java:2: error: as of release 5, 'enum' is a keyword, and may not be used as an identifier
          enum Inner { }
          ^
        (use -source 1.4 or lower to use 'enum' as an identifier)
      E.java:2: error: ',', '}', or ';' expected
          enum Inner { }
               ^
      E.java:2: error: '}' expected
          enum Inner { }
                    ^
      3 errors
      ---

      It would be nice if the parser could handle situations like this better.

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: