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

Add SourceVersion.RELEASE_25

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 25
    • 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_25 to javax.lang.model.SourceVersion for the JDK 25 release and update the FooVisitor14 and FooVisitorPreview visitors to cover release 25 as well.

      Problem

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

      Solution

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

      Specification

      diff 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
      @@ -76,10 +76,11 @@
            *  23: no changes (primitive Types in Patterns, instanceof, and
            *      switch in preview, module Import Declarations in preview,
            *      implicitly declared classes and instance main in third
            *      preview, flexible constructor bodies in second preview)
            *  24: tbd
      +     *  25: tbd
            */
      
           /**
            * The original version.
            *
      @@ -439,20 +440,32 @@
            * @see <a
            * href="https://docs.oracle.com/javase/specs/jls/se24/html/index.html">
            * <cite>The Java Language Specification, Java SE 24 Edition</cite></a>
            */
           RELEASE_24,
      +
      +    /**
      +     * The version introduced by the Java Platform, Standard Edition
      +     * 25.
      +     *
      +     * @since 25
      +     *
      +     * @see <a
      +     * href="https://docs.oracle.com/javase/specs/jls/se25/html/index.html">
      +     * <cite>The Java Language Specification, Java SE 25 Edition</cite></a>
      +     */
      +    RELEASE_25,
           ; // Reduce code churn when appending new constants
      
           // Note that when adding constants for newer releases, the
           // behavior of latest() and latestSupported() must be updated too.
      
           /**
            * {@return the latest source version that can be modeled}
            */
           public static SourceVersion latest() {
      -        return RELEASE_24;
      +        return RELEASE_25;
           }
      
           private static final SourceVersion latestSupported = getLatestSupported();
      
           /*
      @@ -463,11 +476,11 @@
            * need to be updated accordingly.
            */
           private static SourceVersion getLatestSupported() {
               int intVersion = Runtime.version().feature();
               return (intVersion >= 11) ?
      -            valueOf("RELEASE_" + Math.min(24, intVersion)):
      +            valueOf("RELEASE_" + Math.min(25, intVersion)):
                   RELEASE_10;
           }
      
           /**
            * {@return the latest source version fully supported by the
      diff 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
      @@ -42,11 +42,11 @@
        * @see AbstractAnnotationValueVisitor7
        * @see AbstractAnnotationValueVisitor8
        * @see AbstractAnnotationValueVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
      
           /**
            * Constructor for concrete subclasses to call.
            */
      diff 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
      @@ -48,11 +48,11 @@
        * @see AbstractAnnotationValueVisitor8
        * @see AbstractAnnotationValueVisitor9
        * @see AbstractAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractAnnotationValueVisitorPreview<R, P> extends AbstractAnnotationValueVisitor14<R, P> {
      
           /**
            * Constructor for concrete subclasses to call.
      diff 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
      @@ -48,11 +48,11 @@
        * @see AbstractElementVisitor7
        * @see AbstractElementVisitor8
        * @see AbstractElementVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses to call.
            */
           protected AbstractElementVisitor14(){
      diff 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
      @@ -51,11 +51,11 @@
        * @see AbstractElementVisitor8
        * @see AbstractElementVisitor9
        * @see AbstractElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractElementVisitorPreview<R, P> extends AbstractElementVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses to call.
            */
      diff 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
      @@ -45,11 +45,11 @@
        * @see AbstractTypeVisitor7
        * @see AbstractTypeVisitor8
        * @see AbstractTypeVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses to call.
            */
           protected AbstractTypeVisitor14() {
      diff 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
      @@ -51,11 +51,11 @@
        * @see AbstractTypeVisitor8
        * @see AbstractTypeVisitor9
        * @see AbstractTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public abstract class AbstractTypeVisitorPreview<R, P> extends AbstractTypeVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses to call.
            */
      diff 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
      @@ -59,11 +59,11 @@
        * @see ElementKindVisitor7
        * @see ElementKindVisitor8
        * @see ElementKindVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
            */
      diff 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
      @@ -65,11 +65,11 @@
        * @see ElementKindVisitor8
        * @see ElementKindVisitor9
        * @see ElementKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class ElementKindVisitorPreview<R, P> extends ElementKindVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      diff 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
      @@ -75,11 +75,11 @@
        * @see ElementScanner7
        * @see ElementScanner8
        * @see ElementScanner9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
            */
      diff 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
      @@ -79,11 +79,11 @@
        * @see ElementScanner8
        * @see ElementScanner9
        * @see ElementScanner14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class ElementScannerPreview<R, P> extends ElementScanner14<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      diff 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
      @@ -50,11 +50,11 @@
        * @see SimpleAnnotationValueVisitor7
        * @see SimpleAnnotationValueVisitor8
        * @see SimpleAnnotationValueVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
            */
      diff 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
      @@ -56,11 +56,11 @@
        * @see SimpleAnnotationValueVisitor8
        * @see SimpleAnnotationValueVisitor9
        * @see SimpleAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleAnnotationValueVisitorPreview<R, P> extends SimpleAnnotationValueVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      diff 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
      @@ -56,11 +56,11 @@
        * @see SimpleElementVisitor7
        * @see SimpleElementVisitor8
        * @see SimpleElementVisitor9
        * @since 16
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
            */
      diff 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
      @@ -59,11 +59,11 @@
        * @see SimpleElementVisitor8
        * @see SimpleElementVisitor9
        * @see SimpleElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleElementVisitorPreview<R, P> extends SimpleElementVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      diff 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
      @@ -54,11 +54,11 @@
        * @see SimpleTypeVisitor7
        * @see SimpleTypeVisitor8
        * @see SimpleTypeVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
            */
      diff 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
      @@ -60,11 +60,11 @@
        * @see SimpleTypeVisitor8
        * @see SimpleTypeVisitor9
        * @see SimpleTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class SimpleTypeVisitorPreview<R, P> extends SimpleTypeVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      diff 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
      @@ -59,11 +59,11 @@
        * @see TypeKindVisitor7
        * @see TypeKindVisitor8
        * @see TypeKindVisitor9
        * @since 14
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}
            * for the default value.
            */
      diff 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
      @@ -64,11 +64,11 @@
        * @see TypeKindVisitor8
        * @see TypeKindVisitor9
        * @see TypeKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_24)
      +@SupportedSourceVersion(RELEASE_25)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class TypeKindVisitorPreview<R, P> extends TypeKindVisitor14<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}
            * for the default value.

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

              Created:
              Updated:
              Resolved: