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

3.8: Clarify that Identifier is not a ReservedKeyword

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 18
    • specification

      JLS18 defines Identifier to exclude every Keyword:

        Identifier:
          IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral

      which makes TypeIdentifier's exclusion of certain keywords rather redundant:

        TypeIdentifier:
          Identifier but not permits, record, sealed, var, or yield

      3.5's tokenization rules are clear that identifiers are exclusive with, specifically, _reserved_ keywords: "A sequence of input characters that could be reduced to either an identifier token or a reserved keyword token (§3.9) is always reduced to a reserved keyword token."

      Therefore, Identifier should exclude ReservedKeyword, not Keyword:

        Identifier:
          IdentifierChars but not a ***ReservedKeyword*** or BooleanLiteral or NullLiteral

            gbierman Gavin Bierman
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: