diff --git a/.jcheck/conf b/.jcheck/conf
index 6f2de4d3805..8993c274fe0 100644
--- a/.jcheck/conf
+++ b/.jcheck/conf
@@ -1,7 +1,7 @@
[general]
project=jdk
jbs=JDK
-version=20
+version=21
[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf
index 5be559266fe..4a3e5133567 100644
--- a/make/conf/version-numbers.conf
+++ b/make/conf/version-numbers.conf
@@ -26,17 +26,17 @@
# Default version, product, and vendor information to use,
# unless overridden by configure
-DEFAULT_VERSION_FEATURE=20
+DEFAULT_VERSION_FEATURE=21
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_EXTRA1=0
DEFAULT_VERSION_EXTRA2=0
DEFAULT_VERSION_EXTRA3=0
-DEFAULT_VERSION_DATE=2023-03-21
-DEFAULT_VERSION_CLASSFILE_MAJOR=64 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_DATE=2023-09-19
+DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
-DEFAULT_ACCEPTABLE_BOOT_VERSIONS="19 20"
-DEFAULT_JDK_SOURCE_TARGET_VERSION=20
+DEFAULT_ACCEPTABLE_BOOT_VERSIONS="19 20 21"
+DEFAULT_JDK_SOURCE_TARGET_VERSION=21
DEFAULT_PROMOTED_VERSION_PRE=ea
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
index b8b6eab1d03..e1837f3ca86 100644
--- a/src/hotspot/share/classfile/classFileParser.cpp
+++ b/src/hotspot/share/classfile/classFileParser.cpp
@@ -142,6 +142,8 @@
#define JAVA_20_VERSION 64
+#define JAVA_21_VERSION 65
+
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
assert((bad_constant == JVM_CONSTANT_Module ||
bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION,
diff --git a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java
index b1258f0236d..65d8aa991ce 100644
--- a/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java
+++ b/src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java
@@ -262,7 +262,17 @@ public enum ClassFileFormatVersion {
* href="https://docs.oracle.com/javase/specs/jvms/se20/html/index.html">
* The Java Virtual Machine Specification, Java SE 20 Edition
*/
- RELEASE_20(64);
+ RELEASE_20(64),
+
+ /**
+ * The version recognized by the Java Platform, Standard Edition
+ * 21.
+ *
+ * @see
+ * The Java Virtual Machine Specification, Java SE 21 Edition
+ */
+ RELEASE_21(65);
// Note to maintainers: when adding constants for newer releases,
// the implementation of latest() must be updated too.
@@ -277,7 +287,7 @@ public enum ClassFileFormatVersion {
* {@return the latest class file format version}
*/
public static ClassFileFormatVersion latest() {
- return RELEASE_20;
+ return RELEASE_21;
}
/**
diff --git a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
index 37d194583fb..ec1ee7fdef6 100644
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
@@ -226,7 +226,7 @@ public class ClassReader {
this.b = classFileBuffer;
// Check the class' major_version. This field is after the magic and minor_version fields, which
// use 4 and 2 bytes respectively.
- if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V20) {
+ if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V21) {
throw new IllegalArgumentException(
"Unsupported class file major version " + readShort(classFileOffset + 6));
}
diff --git a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java
index a28714e858b..7a90e3d1bdb 100644
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java
@@ -310,6 +310,7 @@ public interface Opcodes {
int V18 = 0 << 16 | 62;
int V19 = 0 << 16 | 63;
int V20 = 0 << 16 | 64;
+ int V21 = 0 << 16 | 65;
/**
* Version flag indicating that the class is using 'preview' features.
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 be3fb580de7..00cdbe320c5 100644
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
@@ -71,6 +71,7 @@ public enum SourceVersion {
* record patterns in preview)
* 20: no changes (pattern matching for switch in fourth preview,
* record patterns in second preview)
+ * 21: tbd
*/
/**
@@ -372,7 +373,19 @@ public enum SourceVersion {
* href="https://docs.oracle.com/javase/specs/jls/se20/html/index.html">
* The Java Language Specification, Java SE 20 Edition
*/
- RELEASE_20;
+ RELEASE_20,
+
+ /**
+ * The version recognized by the Java Platform, Standard Edition
+ * 21.
+ *
+ * @since 21
+ *
+ * @see
+ * The Java Language Specification, Java SE 21 Edition
+ */
+ RELEASE_21;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
@@ -381,7 +394,7 @@ public enum SourceVersion {
* {@return the latest source version that can be modeled}
*/
public static SourceVersion latest() {
- return RELEASE_20;
+ return RELEASE_21;
}
private static final SourceVersion latestSupported = getLatestSupported();
@@ -396,7 +409,7 @@ public enum SourceVersion {
private static SourceVersion getLatestSupported() {
int intVersion = Runtime.version().feature();
return (intVersion >= 11) ?
- valueOf("RELEASE_" + Math.min(20, intVersion)):
+ valueOf("RELEASE_" + Math.min(21, 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 5696a03ffdf..5206b49ab6c 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 @@ import javax.annotation.processing.SupportedSourceVersion;
* @see AbstractAnnotationValueVisitor9
* @since 14
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractAnnotationValueVisitor14 extends AbstractAnnotationValueVisitor9 {
/**
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 3a373297c8b..d7b51093bce 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
@@ -49,7 +49,7 @@ import static javax.lang.model.SourceVersion.*;
* @see AbstractElementVisitor9
* @since 16
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractElementVisitor14 extends AbstractElementVisitor9 {
/**
* 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 e300b107639..aa7d70cbd70 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 @@ import static javax.lang.model.SourceVersion.*;
* @see AbstractTypeVisitor9
* @since 14
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractTypeVisitor14 extends AbstractTypeVisitor9 {
/**
* 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 db8af23f387..5ce90e144ec 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 @@ import javax.lang.model.SourceVersion;
* @see ElementKindVisitor9
* @since 16
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class ElementKindVisitor14 extends ElementKindVisitor9 {
/**
* 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 0dddf71c245..55cd3e9cd7c 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 @@ import static javax.lang.model.SourceVersion.*;
* @see ElementScanner9
* @since 16
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class ElementScanner14 extends ElementScanner9 {
/**
* 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 87776d91abb..95b51f1cd37 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 @@ import static javax.lang.model.SourceVersion.*;
* @see SimpleAnnotationValueVisitor9
* @since 14
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class SimpleAnnotationValueVisitor14 extends SimpleAnnotationValueVisitor9 {
/**
* 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 6cf1c4de150..bf6c2e0863f 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
@@ -57,7 +57,7 @@ import static javax.lang.model.SourceVersion.*;
* @see SimpleElementVisitor9
* @since 16
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class SimpleElementVisitor14 extends SimpleElementVisitor9 {
/**
* 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 352bd6bb0d1..850668bb8aa 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 @@ import static javax.lang.model.SourceVersion.*;
* @see SimpleTypeVisitor9
* @since 14
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class SimpleTypeVisitor14 extends SimpleTypeVisitor9 {
/**
* 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 a7fbc37ac20..5352e23fa8e 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 @@ import static javax.lang.model.SourceVersion.*;
* @see TypeKindVisitor9
* @since 14
*/
-@SupportedSourceVersion(RELEASE_20)
+@SupportedSourceVersion(RELEASE_21)
public class TypeKindVisitor14 extends TypeKindVisitor9 {
/**
* Constructor for concrete subclasses to call; uses {@code null}
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
index 854e87cf182..d5a452b6612 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
@@ -127,7 +127,12 @@ public enum Source {
/**
* 20, no major changes
*/
- JDK20("20");
+ JDK20("20"),
+
+ /**
+ * 21, tbd
+ */
+ JDK21("21");
private static final Context.Key