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

Better error recovery when parsing enums

    Details

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: