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

Add SourceVersion.RELEASE_23

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • core-libs
    • None
    • source
    • minimal
    • Java API
    • SE

      Summary

      Add a new enum constant RELEASE_23 to javax.lang.model.SourceVersion for the JDK 22 release and update the FooVisitor14 visitors to cover release 23 as well.

      Problem

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

      Solution

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

      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 fd905da80a5..911d7783472 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      @@ -409,6 +409,18 @@ public enum SourceVersion {
            * <cite>The Java Language Specification, Java SE 22 Edition</cite></a>
            */
           RELEASE_22,
      +
      +    /**
      +     * The version introduced by the Java Platform, Standard Edition
      +     * 23.
      +     *
      +     * @since 23
      +     *
      +     * @see <a
      +     * href="https://docs.oracle.com/javase/specs/jls/se23/html/index.html">
      +     * <cite>The Java Language Specification, Java SE 23 Edition</cite></a>
      +     */
      +    RELEASE_23,
           ; // Reduce code churn when appending new constants
      
           // Note that when adding constants for newer releases, the
      @@ -418,7 +430,7 @@ public enum SourceVersion {
            * {@return the latest source version that can be modeled}
            */
           public static SourceVersion latest() {
      -        return RELEASE_22;
      +        return RELEASE_23;
           }
      
           private static final SourceVersion latestSupported = getLatestSupported();
      @@ -433,7 +445,7 @@ public static SourceVersion latest() {
           private static SourceVersion getLatestSupported() {
               int intVersion = Runtime.version().feature();
               return (intVersion >= 11) ?
      -            valueOf("RELEASE_" + Math.min(22, intVersion)):
      +            valueOf("RELEASE_" + Math.min(23, 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 66f73f0154f..95e6cef760c 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 @@
        * @see AbstractAnnotationValueVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 2aafe0b9d3e..fdf0d1c7381 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
      @@ -50,7 +50,7 @@
        * @see AbstractElementVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 555564b7535..234dac8ee5c 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 @@
        * @see AbstractTypeVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 fc97497913c..919ce5d4256 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 @@
        * @see ElementKindVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 e8406737938..8108cf49f43 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
      @@ -78,7 +78,7 @@
        * @see ElementScanner9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 8700db6d424..577ee80055d 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 @@
        * @see SimpleAnnotationValueVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 34efdaf71d3..ce8b9d15617 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
      @@ -58,7 +58,7 @@
        * @see SimpleElementVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 6bb75b4c0b6..0b6f09a5b6d 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 @@
        * @see SimpleTypeVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       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 5ffc131c96e..4948771d436 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 @@
        * @see TypeKindVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_22)
      +@SupportedSourceVersion(RELEASE_23)
       public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}

            darcy Joe Darcy
            darcy Joe Darcy
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: