Skip to content

Commit

Permalink
8296149: Start of release updates for JDK 21
Browse files Browse the repository at this point in the history
8296150: Add SourceVersion.RELEASE_21
8296151: Add source 21 and target 21 to javac

Reviewed-by: dholmes, iris, erikj, vromero, jlahoda
  • Loading branch information
jddarcy authored and JesperIRL committed Dec 8, 2022
1 parent d562d3f commit 175e3d3
Show file tree
Hide file tree
Showing 70 changed files with 5,338 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions make/conf/version-numbers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/hotspot/share/classfile/classFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,17 @@ public enum ClassFileFormatVersion {
* href="https://docs.oracle.com/javase/specs/jvms/se20/html/index.html">
* <cite>The Java Virtual Machine Specification, Java SE 20 Edition</cite></a>
*/
RELEASE_20(64);
RELEASE_20(64),

/**
* The version recognized by the Java Platform, Standard Edition
* 21.
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jvms/se21/html/index.html">
* <cite>The Java Virtual Machine Specification, Java SE 21 Edition</cite></a>
*/
RELEASE_21(65);

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public 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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand Down Expand Up @@ -372,7 +373,19 @@ public enum SourceVersion {
* href="https://docs.oracle.com/javase/specs/jls/se20/html/index.html">
* <cite>The Java Language Specification, Java SE 20 Edition</cite></a>
*/
RELEASE_20;
RELEASE_20,

/**
* The version recognized by the Java Platform, Standard Edition
* 21.
*
* @since 21
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jls/se21/html/index.html">
* <cite>The Java Language Specification, Java SE 21 Edition</cite></a>
*/
RELEASE_21;

// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
Expand All @@ -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();
Expand All @@ -396,7 +409,7 @@ public static SourceVersion latest() {
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @see AbstractAnnotationValueVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @see AbstractElementVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @see AbstractTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @see ElementKindVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* @see ElementScanner9
* @since 16
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @see SimpleAnnotationValueVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* @see SimpleElementVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* @see SimpleTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @see TypeKindVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_20)
@SupportedSourceVersion(RELEASE_21)
public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ public enum Source {
/**
* 20, no major changes
*/
JDK20("20");
JDK20("20"),

/**
* 21, tbd
*/
JDK21("21");

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

Expand Down Expand Up @@ -179,6 +184,7 @@ public boolean isSupported() {

public Target requiredTarget() {
return switch(this) {
case JDK21 -> Target.JDK1_21;
case JDK20 -> Target.JDK1_20;
case JDK19 -> Target.JDK1_19;
case JDK18 -> Target.JDK1_18;
Expand Down Expand Up @@ -312,6 +318,7 @@ public static SourceVersion toSourceVersion(Source source) {
case JDK18 -> RELEASE_18;
case JDK19 -> RELEASE_19;
case JDK20 -> RELEASE_20;
case JDK21 -> RELEASE_21;
default -> null;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public enum Version {
V61(61, 0), // JDK 17
V62(62, 0), // JDK 18
V63(63, 0), // JDK 19
V64(64, 0); // JDK 20
V64(64, 0), // JDK 20
V65(65, 0); // JDK 21
Version(int major, int minor) {
this.major = major;
this.minor = minor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public enum Target {
JDK1_19("19", 63, 0),

/** JDK 20. */
JDK1_20("20", 64, 0);
JDK1_20("20", 64, 0),

/** JDK 21. */
JDK1_21("21", 65, 0);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_20)
@SupportedSourceVersion(SourceVersion.RELEASE_21)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;

Expand Down

3 comments on commit 175e3d3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JesperIRL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tag jdk-21+1

@openjdk
Copy link

@openjdk openjdk bot commented on 175e3d3 Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JesperIRL The tag jdk-21+1 was successfully created.

Please sign in to comment.