-
CSR
-
Resolution: Approved
-
P4
-
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_26
to javax.lang.model.SourceVersion
for the JDK 26 release and update the FooVisitor14 and FooVisitorPreview visitors to cover release 26 as well.
Problem
The SourceVersion
enum needs an enum constant for each release being modeled.
Solution
Append the enum constant RELEASE_26
and update the visitor text and supported source version annotations to cover from RELEASE_14 to RELEASE_26. 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
index 9260ce532f1..2e4537e5903 100644
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
@@ -456,6 +456,18 @@ public enum SourceVersion {
* <cite>The Java Language Specification, Java SE 25 Edition</cite></a>
*/
RELEASE_25,
+
+ /**
+ * The version introduced by the Java Platform, Standard Edition
+ * 26.
+ *
+ * @since 26
+ *
+ * @see <a
+ * href="https://docs.oracle.com/javase/specs/jls/se26/html/index.html">
+ * <cite>The Java Language Specification, Java SE 26 Edition</cite></a>
+ */
+ RELEASE_26,
; // Reduce code churn when appending new constants
// Note that when adding constants for newer releases, the
@@ -465,7 +477,7 @@ public enum SourceVersion {
* {@return the latest source version that can be modeled}
*/
public static SourceVersion latest() {
- return RELEASE_25;
+ return RELEASE_26;
}
private static final SourceVersion latestSupported = getLatestSupported();
@@ -480,7 +492,7 @@ public static SourceVersion latest() {
private static SourceVersion getLatestSupported() {
int intVersion = Runtime.version().feature();
return (intVersion >= 11) ?
- valueOf("RELEASE_" + Math.min(25, intVersion)):
+ valueOf("RELEASE_" + Math.min(26, 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 4d36781c584..7bf7c6451ce 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 4afcc7fbf1d..c2609f6ed2b 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
@@ -50,7 +50,7 @@
* @see AbstractAnnotationValueVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 3a57ef18c5b..22dceba5fe6 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 b9642b203fe..13b7ac74a16 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
@@ -53,7 +53,7 @@
* @see AbstractElementVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 eb96f4abb99..1759514e56b 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 74b007356d4..f4c0d9cec9b 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
@@ -53,7 +53,7 @@
* @see AbstractTypeVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 d7941d6e153..7ad51ec225c 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 868e89c23eb..9650af4ff82 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
@@ -67,7 +67,7 @@
* @see ElementKindVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 e0c05ab228e..899ee0d784f 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 @@
* @see ElementScanner9
* @since 16
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
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 6d80aa8c661..fb2abe910b3 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
@@ -81,7 +81,7 @@
* @see ElementScanner14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 4682e2a7ee8..765aa92848a 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 a477f33017c..8a6aa7e7563 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
@@ -58,7 +58,7 @@
* @see SimpleAnnotationValueVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 db97e59152f..9f313b46495 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 0d9914f3852..e7f7b35ffce 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
@@ -61,7 +61,7 @@
* @see SimpleElementVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 3f962137987..7162adcbcf9 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 13a0ad41d7e..487c111ae92 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
@@ -62,7 +62,7 @@
* @see SimpleTypeVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@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 57d43e77500..493f00690b2 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_25)
+@SupportedSourceVersion(RELEASE_26)
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 3ae19353a0b..9dac23f23d9 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
@@ -66,7 +66,7 @@
* @see TypeKindVisitor14
* @since 23
*/
-@SupportedSourceVersion(RELEASE_25)
+@SupportedSourceVersion(RELEASE_26)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class TypeKindVisitorPreview<R, P> extends TypeKindVisitor14<R, P> {
/**
- csr of
-
JDK-8355748 Add SourceVersion.RELEASE_26
-
- Open
-
- relates to
-
JDK-8342999 Add SourceVersion.RELEASE_25
-
- Closed
-