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

Terminology mismatch between JLS17-3.9 and SE17's javax.lang.model.SourceVersion method specs

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 18
    • core-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      Update specification text in javax.lang.model.SourceVersion for changes in JLS terminology.

      Problem

      In Java SE 17, the JLS retired the "restricted keyword" and "restricted identifier" terminology and various methods using those terms in SourceVersion were not updated.

      Solution

      Update the affected methods to use the revised terminology.

      Specification

      --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      @@ -312,8 +312,8 @@ public enum SourceVersion {
            * Character#isJavaIdentifierStart(int)} returns {@code true},
            * followed only by characters for which {@link
            * Character#isJavaIdentifierPart(int)} returns {@code true}.
      -     * This pattern matches regular identifiers, keywords, restricted
      -     * keywords, restricted identifiers and the literals {@code "true"},
      +     * This pattern matches regular identifiers, keywords, contextual
      +     * keywords, and the literals {@code "true"},
            * {@code "false"}, {@code "null"}.
            *
            * The method returns {@code false} for all other strings.
      @@ -359,8 +359,8 @@ public enum SourceVersion {
            * {@code false} for keywords, boolean literals, and the null
            * literal in any segment.
            *
      -     * This method returns {@code true} for <i>restricted
      -     * keywords</i> and <i>restricted identifiers</i>.
      +     * This method returns {@code true} for <i>contextual
      +     * keywords</i>.
            *
            * @param name the string to check
            * @return {@code true} if this string is a
      @@ -385,8 +385,8 @@ public enum SourceVersion {
            * {@code false} for keywords, boolean literals, and the null
            * literal in any segment.
            *
      -     * This method returns {@code true} for <i>restricted
      -     * keywords</i> and <i>restricted identifiers</i>.
      +     * This method returns {@code true} for <i>contextual
      +     * keywords</i>.
            *
            * @param name the string to check
            * @param version the version to use
      @@ -409,8 +409,8 @@ public enum SourceVersion {
           /**
            * Returns whether or not {@code s} is a keyword, boolean literal,
            * or null literal in the latest source version.
      -     * This method returns {@code false} for <i>restricted
      -     * keywords</i> and <i>restricted identifiers</i>.
      +     * This method returns {@code false} for <i>contextual
      +     * keywords</i>.
            *
            * @param s the string to check
            * @return {@code true} if {@code s} is a keyword, or boolean
      @@ -426,8 +426,8 @@ public enum SourceVersion {
           /**
            * Returns whether or not {@code s} is a keyword, boolean literal,
            * or null literal in the given source version.
      -     * This method returns {@code false} for <i>restricted
      -     * keywords</i> and <i>restricted identifiers</i>.
      +     * This method returns {@code false} for <i>contextual
      +     * keywords</i>.
            *
            * @param s the string to check
            * @param version the version to use

            darcy Joe Darcy
            dbessono Dmitry Bessonov
            Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: