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

Add SourceVersion.RELEASE_24

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API
    • SE

      Summary

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

      Problem

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

      Solution

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

      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 734ca29a0a2..fd3cb1cb0f8 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -427,6 +427,18 @@ public enum SourceVersion {
            * <cite>The Java Language Specification, Java SE 23 Edition</cite></a>
            */
           RELEASE_23,
      +
      +    /**
      +     * The version introduced by the Java Platform, Standard Edition
      +     * 24.
      +     *
      +     * @since 24
      +     *
      +     * @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,
           ; // Reduce code churn when appending new constants
      
           // Note that when adding constants for newer releases, the
      @@ -436,7 +448,7 @@ public enum SourceVersion {
            * {@return the latest source version that can be modeled}
            */
           public static SourceVersion latest() {
      -        return RELEASE_23;
      +        return RELEASE_24;
           }
      
           private static final SourceVersion latestSupported = getLatestSupported();
      @@ -451,7 +463,7 @@ public static SourceVersion latest() {
           private static SourceVersion getLatestSupported() {
               int intVersion = Runtime.version().feature();
               return (intVersion >= 11) ?
      -            valueOf("RELEASE_" + Math.min(23, intVersion)):
      +            valueOf("RELEASE_" + Math.min(24, 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 cbb55b09662..01a29cc3c1e 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index 0e504e192bd..7925bb6d67b 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java
      @@ -49,7 +49,7 @@
        * @see AbstractAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index fdf0d1c7381..b9191a72547 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index eb361654394..43fb49430c2 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java
      @@ -54,7 +54,7 @@
        * @see AbstractElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index f3c64cb0e12..8e5ead882e8 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index 5da08ee004e..ca28488792a 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java
      @@ -52,7 +52,7 @@
        * @see AbstractTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index 919ce5d4256..85691a8b3a9 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index 01c70ea11d5..452797d623d 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java
      @@ -66,7 +66,7 @@
        * @see ElementKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index 8108cf49f43..ac79d626242 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index 511141a5093..6afb01fd4af 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java
      @@ -82,7 +82,7 @@
        * @see ElementScanner14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index 4b0ebb241fd..6fce848c834 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index a16a82a79fb..ca6eecc9d76 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java
      @@ -57,7 +57,7 @@
        * @see SimpleAnnotationValueVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index ce8b9d15617..b462688d8e1 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index 02c2d78daed..739b968d2db 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java
      @@ -62,7 +62,7 @@
        * @see SimpleElementVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index 618db0bf86a..b86f84f6b9a 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index bac2e2a87a1..287a9f9523b 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java
      @@ -61,7 +61,7 @@
        * @see SimpleTypeVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @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
      index 558e2bab914..db431bf428d 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_23)
      +@SupportedSourceVersion(RELEASE_24)
       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
      index b1458706091..f346c5cddfa 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java
      @@ -65,7 +65,7 @@
        * @see TypeKindVisitor14
        * @since 23
        */
      -@SupportedSourceVersion(RELEASE_23)
      +@SupportedSourceVersion(RELEASE_24)
       @PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
       public class TypeKindVisitorPreview<R, P> extends TypeKindVisitor14<R, P> {
           /**

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

              Created:
              Updated:
              Resolved: