Skip to content

Commit 175e3d3

Browse files
jddarcyJesperIRL
authored andcommitted
8296149: Start of release updates for JDK 21
8296150: Add SourceVersion.RELEASE_21 8296151: Add source 21 and target 21 to javac Reviewed-by: dholmes, iris, erikj, vromero, jlahoda
1 parent d562d3f commit 175e3d3

File tree

70 files changed

+5338
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5338
-54
lines changed

Diff for: .jcheck/conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[general]
22
project=jdk
33
jbs=JDK
4-
version=20
4+
version=21
55

66
[checks]
77
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists

Diff for: make/conf/version-numbers.conf

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
# Default version, product, and vendor information to use,
2727
# unless overridden by configure
2828

29-
DEFAULT_VERSION_FEATURE=20
29+
DEFAULT_VERSION_FEATURE=21
3030
DEFAULT_VERSION_INTERIM=0
3131
DEFAULT_VERSION_UPDATE=0
3232
DEFAULT_VERSION_PATCH=0
3333
DEFAULT_VERSION_EXTRA1=0
3434
DEFAULT_VERSION_EXTRA2=0
3535
DEFAULT_VERSION_EXTRA3=0
36-
DEFAULT_VERSION_DATE=2023-03-21
37-
DEFAULT_VERSION_CLASSFILE_MAJOR=64 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
36+
DEFAULT_VERSION_DATE=2023-09-19
37+
DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
3838
DEFAULT_VERSION_CLASSFILE_MINOR=0
3939
DEFAULT_VERSION_DOCS_API_SINCE=11
40-
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="19 20"
41-
DEFAULT_JDK_SOURCE_TARGET_VERSION=20
40+
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="19 20 21"
41+
DEFAULT_JDK_SOURCE_TARGET_VERSION=21
4242
DEFAULT_PROMOTED_VERSION_PRE=ea

Diff for: src/hotspot/share/classfile/classFileParser.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142

143143
#define JAVA_20_VERSION 64
144144

145+
#define JAVA_21_VERSION 65
146+
145147
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
146148
assert((bad_constant == JVM_CONSTANT_Module ||
147149
bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION,

Diff for: src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,17 @@ public enum ClassFileFormatVersion {
262262
* href="https://docs.oracle.com/javase/specs/jvms/se20/html/index.html">
263263
* <cite>The Java Virtual Machine Specification, Java SE 20 Edition</cite></a>
264264
*/
265-
RELEASE_20(64);
265+
RELEASE_20(64),
266+
267+
/**
268+
* The version recognized by the Java Platform, Standard Edition
269+
* 21.
270+
*
271+
* @see <a
272+
* href="https://docs.oracle.com/javase/specs/jvms/se21/html/index.html">
273+
* <cite>The Java Virtual Machine Specification, Java SE 21 Edition</cite></a>
274+
*/
275+
RELEASE_21(65);
266276

267277
// Note to maintainers: when adding constants for newer releases,
268278
// the implementation of latest() must be updated too.
@@ -277,7 +287,7 @@ private ClassFileFormatVersion(int major) {
277287
* {@return the latest class file format version}
278288
*/
279289
public static ClassFileFormatVersion latest() {
280-
return RELEASE_20;
290+
return RELEASE_21;
281291
}
282292

283293
/**

Diff for: src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public ClassReader(
226226
this.b = classFileBuffer;
227227
// Check the class' major_version. This field is after the magic and minor_version fields, which
228228
// use 4 and 2 bytes respectively.
229-
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V20) {
229+
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V21) {
230230
throw new IllegalArgumentException(
231231
"Unsupported class file major version " + readShort(classFileOffset + 6));
232232
}

Diff for: src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ public interface Opcodes {
310310
int V18 = 0 << 16 | 62;
311311
int V19 = 0 << 16 | 63;
312312
int V20 = 0 << 16 | 64;
313+
int V21 = 0 << 16 | 65;
313314

314315
/**
315316
* Version flag indicating that the class is using 'preview' features.

Diff for: src/java.compiler/share/classes/javax/lang/model/SourceVersion.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public enum SourceVersion {
7171
* record patterns in preview)
7272
* 20: no changes (pattern matching for switch in fourth preview,
7373
* record patterns in second preview)
74+
* 21: tbd
7475
*/
7576

7677
/**
@@ -372,7 +373,19 @@ public enum SourceVersion {
372373
* href="https://docs.oracle.com/javase/specs/jls/se20/html/index.html">
373374
* <cite>The Java Language Specification, Java SE 20 Edition</cite></a>
374375
*/
375-
RELEASE_20;
376+
RELEASE_20,
377+
378+
/**
379+
* The version recognized by the Java Platform, Standard Edition
380+
* 21.
381+
*
382+
* @since 21
383+
*
384+
* @see <a
385+
* href="https://docs.oracle.com/javase/specs/jls/se21/html/index.html">
386+
* <cite>The Java Language Specification, Java SE 21 Edition</cite></a>
387+
*/
388+
RELEASE_21;
376389

377390
// Note that when adding constants for newer releases, the
378391
// behavior of latest() and latestSupported() must be updated too.
@@ -381,7 +394,7 @@ public enum SourceVersion {
381394
* {@return the latest source version that can be modeled}
382395
*/
383396
public static SourceVersion latest() {
384-
return RELEASE_20;
397+
return RELEASE_21;
385398
}
386399

387400
private static final SourceVersion latestSupported = getLatestSupported();
@@ -396,7 +409,7 @@ public static SourceVersion latest() {
396409
private static SourceVersion getLatestSupported() {
397410
int intVersion = Runtime.version().feature();
398411
return (intVersion >= 11) ?
399-
valueOf("RELEASE_" + Math.min(20, intVersion)):
412+
valueOf("RELEASE_" + Math.min(21, intVersion)):
400413
RELEASE_10;
401414
}
402415

Diff for: src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* @see AbstractAnnotationValueVisitor9
4545
* @since 14
4646
*/
47-
@SupportedSourceVersion(RELEASE_20)
47+
@SupportedSourceVersion(RELEASE_21)
4848
public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
4949

5050
/**

Diff for: src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* @see AbstractElementVisitor9
5050
* @since 16
5151
*/
52-
@SupportedSourceVersion(RELEASE_20)
52+
@SupportedSourceVersion(RELEASE_21)
5353
public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
5454
/**
5555
* Constructor for concrete subclasses to call.

Diff for: src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* @see AbstractTypeVisitor9
4848
* @since 14
4949
*/
50-
@SupportedSourceVersion(RELEASE_20)
50+
@SupportedSourceVersion(RELEASE_21)
5151
public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
5252
/**
5353
* Constructor for concrete subclasses to call.

Diff for: src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* @see ElementKindVisitor9
6262
* @since 16
6363
*/
64-
@SupportedSourceVersion(RELEASE_20)
64+
@SupportedSourceVersion(RELEASE_21)
6565
public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
6666
/**
6767
* Constructor for concrete subclasses; uses {@code null} for the

Diff for: src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
* @see ElementScanner9
7878
* @since 16
7979
*/
80-
@SupportedSourceVersion(RELEASE_20)
80+
@SupportedSourceVersion(RELEASE_21)
8181
public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
8282
/**
8383
* Constructor for concrete subclasses; uses {@code null} for the

Diff for: src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* @see SimpleAnnotationValueVisitor9
5353
* @since 14
5454
*/
55-
@SupportedSourceVersion(RELEASE_20)
55+
@SupportedSourceVersion(RELEASE_21)
5656
public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
5757
/**
5858
* Constructor for concrete subclasses; uses {@code null} for the

Diff for: src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
* @see SimpleElementVisitor9
5858
* @since 16
5959
*/
60-
@SupportedSourceVersion(RELEASE_20)
60+
@SupportedSourceVersion(RELEASE_21)
6161
public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
6262
/**
6363
* Constructor for concrete subclasses; uses {@code null} for the

Diff for: src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* @see SimpleTypeVisitor9
5757
* @since 14
5858
*/
59-
@SupportedSourceVersion(RELEASE_20)
59+
@SupportedSourceVersion(RELEASE_21)
6060
public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
6161
/**
6262
* Constructor for concrete subclasses; uses {@code null} for the

Diff for: src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* @see TypeKindVisitor9
6262
* @since 14
6363
*/
64-
@SupportedSourceVersion(RELEASE_20)
64+
@SupportedSourceVersion(RELEASE_21)
6565
public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
6666
/**
6767
* Constructor for concrete subclasses to call; uses {@code null}

Diff for: src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ public enum Source {
127127
/**
128128
* 20, no major changes
129129
*/
130-
JDK20("20");
130+
JDK20("20"),
131+
132+
/**
133+
* 21, tbd
134+
*/
135+
JDK21("21");
131136

132137
private static final Context.Key<Source> sourceKey = new Context.Key<>();
133138

@@ -179,6 +184,7 @@ public boolean isSupported() {
179184

180185
public Target requiredTarget() {
181186
return switch(this) {
187+
case JDK21 -> Target.JDK1_21;
182188
case JDK20 -> Target.JDK1_20;
183189
case JDK19 -> Target.JDK1_19;
184190
case JDK18 -> Target.JDK1_18;
@@ -312,6 +318,7 @@ public static SourceVersion toSourceVersion(Source source) {
312318
case JDK18 -> RELEASE_18;
313319
case JDK19 -> RELEASE_19;
314320
case JDK20 -> RELEASE_20;
321+
case JDK21 -> RELEASE_21;
315322
default -> null;
316323
};
317324
}

Diff for: src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public enum Version {
121121
V61(61, 0), // JDK 17
122122
V62(62, 0), // JDK 18
123123
V63(63, 0), // JDK 19
124-
V64(64, 0); // JDK 20
124+
V64(64, 0), // JDK 20
125+
V65(65, 0); // JDK 21
125126
Version(int major, int minor) {
126127
this.major = major;
127128
this.minor = minor;

Diff for: src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ public enum Target {
9494
JDK1_19("19", 63, 0),
9595

9696
/** JDK 20. */
97-
JDK1_20("20", 64, 0);
97+
JDK1_20("20", 64, 0),
98+
99+
/** JDK 21. */
100+
JDK1_21("21", 65, 0);
98101

99102
private static final Context.Key<Target> targetKey = new Context.Key<>();
100103

Diff for: src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
* deletion without notice.</b>
5656
*/
5757
@SupportedAnnotationTypes("*")
58-
@SupportedSourceVersion(SourceVersion.RELEASE_20)
58+
@SupportedSourceVersion(SourceVersion.RELEASE_21)
5959
public class PrintingProcessor extends AbstractProcessor {
6060
PrintWriter writer;
6161

0 commit comments

Comments
 (0)