JDK-8286096 : Add SourceVersion.RELEASE_20
  • Type: CSR
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 20
  • Submitted: 2022-05-03
  • Updated: 2022-11-01
  • Resolved: 2022-05-03
Related Reports
CSR :  
Relates :  
Relates :  
Description
Summary
-------

Add a new enum constant `RELEASE_20` to `javax.lang.model.SourceVersion` for the JDK 20 release and update the FooVisitor14 visitors to cover release 20 as well.

Problem
-------

The `SourceVersion` enum needs an enum constant for each release being modeled.

Solution
--------

Append the enum constant `RELEASE_20` and update the visitor text and supported source version annotations to cover from RELEASE_14 to RELEASE_20.

Specification
-------------

    diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
    index 414313e8714..2baa761d6b6 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
    @@ -348,7 +348,15 @@ public enum SourceVersion {
          *
          * @since 19
          */
    -    RELEASE_19;
    +    RELEASE_19,
    +
    +    /**
    +     * The version recognized by the Java Platform, Standard Edition
    +     * 20.
    +     *
    +     * @since 20
    +     */
    +    RELEASE_20;
     
         // Note that when adding constants for newer releases, the
         // behavior of latest() and latestSupported() must be updated too.
    @@ -357,7 +365,7 @@ public enum SourceVersion {
          * {@return the latest source version that can be modeled}
          */
         public static SourceVersion latest() {
    -        return RELEASE_19;
    +        return RELEASE_20;
         }
     
         private static final SourceVersion latestSupported = getLatestSupported();
    @@ -372,7 +380,7 @@ public enum SourceVersion {
         private static SourceVersion getLatestSupported() {
             int intVersion = Runtime.version().feature();
             return (intVersion >= 11) ?
    -            valueOf("RELEASE_" + Math.min(19, intVersion)):
    +            valueOf("RELEASE_" + Math.min(20, intVersion)):
                 RELEASE_10;
         }
     
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java
    index 004aa596b3a..5696a03ffdf 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java
    @@ -44,7 +44,7 @@ import javax.annotation.processing.SupportedSourceVersion;
      * @see AbstractAnnotationValueVisitor9
      * @since 14
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
     
         /**
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java
    index 8200e6c00de..2a7d61ad1f1 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java
    @@ -49,7 +49,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see AbstractElementVisitor9
      * @since 16
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call.
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java
    index a2a9d098e6b..e300b107639 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java
    @@ -47,7 +47,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see AbstractTypeVisitor9
      * @since 14
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call.
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java
    index 93b035e1772..db8af23f387 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java
    @@ -61,7 +61,7 @@ import javax.lang.model.SourceVersion;
      * @see ElementKindVisitor9
      * @since 16
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java
    index 4365c6df53c..0dddf71c245 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java
    @@ -77,7 +77,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see ElementScanner9
      * @since 16
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java
    index 9174602cde0..87776d91abb 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java
    @@ -52,7 +52,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see SimpleAnnotationValueVisitor9
      * @since 14
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java
    index 8e992025e4a..6cf1c4de150 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java
    @@ -57,7 +57,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see SimpleElementVisitor9
      * @since 16
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java
    index 86e7cb1d981..352bd6bb0d1 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java
    @@ -56,7 +56,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see SimpleTypeVisitor9
      * @since 14
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
    diff --git a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java
    index b83307c2095..a7fbc37ac20 100644
    --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java
    +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java
    @@ -61,7 +61,7 @@ import static javax.lang.model.SourceVersion.*;
      * @see TypeKindVisitor9
      * @since 14
      */
    -@SupportedSourceVersion(RELEASE_19)
    +@SupportedSourceVersion(RELEASE_20)
     public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call; uses {@code null}


Comments
Moving to Approved.
03-05-2022