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

Sealed Classes: Clarify treatment of `non-sealed` as a keyword

    XMLWordPrintable

Details

    • b19

    Description

      Currently the spec describes the string `non-sealed` as a reserved keyword. This means that according to the spec the following code should fail to compile:

      int test(int non, int sealed) {
        return non-sealed;
      }

      However, this code compiles correctly (with the preview enabled). The spec should be updated with a notion of *contextual keyword* to allow `non-sealed` to be considered a keyword only in the places where needed.

      See http://cr.openjdk.java.net/~gbierman/jep397/jep397-20201104/specs/contextual-keywords-jls.html

      Attachments

        Issue Links

          Activity

            People

              dlsmith Dan Smith
              gbierman Gavin Bierman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: