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

Add SourceVersion.RELEASE_27

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 27
    • core-libs
    • None
    • behavioral
    • minimal
    • Add a new constant to an enum class in the expected manner.
    • Java API
    • SE

      Summary

      Add a new enum constant RELEASE_27 to javax.lang.model.SourceVersion for the JDK 27 release and update the FooVisitor14 and FooVisitorPreview visitors to cover release 27 as well.

      Problem

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

      Solution

      Append the enum constant RELEASE_27 and update the visitor text and supported source version annotations to cover from RELEASE_14 to RELEASE_27. As a consequence of appending a new enum constant, the behavior of the latest() and latestSupported() methods is updated accordingly.

      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
      --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java 
      +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      @@ -480,6 +480,18 @@
            * <cite>The Java Language Specification, Java SE 26 Edition</cite></a>
            */
           RELEASE_26,
      +
      +    /**
      +     * The version introduced by the Java Platform, Standard Edition
      +     * 27.
      +     *
      +     * @since 27
      +     *
      +     * @see <a
      +     * href="https://docs.oracle.com/javase/specs/jls/se27/html/index.html">
      +     * <cite>The Java Language Specification, Java SE 27 Edition</cite></a>
      +     */
      +    RELEASE_27,
           ; // Reduce code churn when appending new constants
      
           // Note that when adding constants for newer releases, the
      @@ -489,7 +501,7 @@
            * {@return the latest source version that can be modeled}
            */
           public static SourceVersion latest() {
      -        return RELEASE_26;
      +        return RELEASE_27;
           }
      
           private static final SourceVersion latestSupported = getLatestSupported();
      @@ -504,7 +516,7 @@
           private static SourceVersion getLatestSupported() {
               int intVersion = Runtime.version().feature();
               return (intVersion >= 11) ?
      -            valueOf("RELEASE_" + Math.min(26, intVersion)):
      +            valueOf("RELEASE_" + Math.min(27, 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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
      
           /**
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java 
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java 
      @@ -50,7 +50,7 @@
        * @see AbstractAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractAnnotationValueVisitorPreview<R, P> extends AbstractAnnotationValueVisitor14<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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/AbstractElementVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java  
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java  
      @@ -53,7 +53,7 @@
        * @see AbstractElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractElementVisitorPreview<R, P> extends AbstractElementVisitor14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/AbstractTypeVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java 
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java 
      @@ -53,7 +53,7 @@
        * @see AbstractTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractTypeVisitorPreview<R, P> extends AbstractTypeVisitor14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/ElementKindVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java 
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java  
      @@ -67,7 +67,7 @@
        * @see ElementKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class ElementKindVisitorPreview<R, P> extends ElementKindVisitor14<R, P> {
           /**
      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
      --- 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 @@
        * @see ElementScanner9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/ElementScannerPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java  
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java  
      @@ -81,7 +81,7 @@
        * @see ElementScanner14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class ElementScannerPreview<R, P> extends ElementScanner14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/SimpleAnnotationValueVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java
      @@ -58,7 +58,7 @@
        * @see SimpleAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleAnnotationValueVisitorPreview<R, P> extends SimpleAnnotationValueVisitor14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/SimpleElementVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java  
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java  
      @@ -61,7 +61,7 @@
        * @see SimpleElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleElementVisitorPreview<R, P> extends SimpleElementVisitor14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       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/SimpleTypeVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java 
      @@ -62,7 +62,7 @@
        * @see SimpleTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleTypeVisitorPreview<R, P> extends SimpleTypeVisitor14<R, P> {
           /**
      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
      --- 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_26)
      +@SupportedSourceVersion(RELEASE_27)
       public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java
      --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java 
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java
      @@ -66,7 +66,7 @@
        * @see TypeKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_26)
      +@SupportedSourceVersion(RELEASE_27)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class TypeKindVisitorPreview<R, P> extends TypeKindVisitor14<R, P> {
           /**

            nbenalla Nizar Benalla
            nbenalla Nizar Benalla
            Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: