JDK-8277325 : Terminology mismatch between JLS17-3.9 and SE17's javax.lang.model.SourceVersion method specs
  • Type: CSR
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 18
  • Submitted: 2021-11-17
  • Updated: 2021-11-17
  • Resolved: 2021-11-17
Related Reports
CSR :  
Description
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



Comments
Moving to Approved.
17-11-2021