Skip to content

Commit

Permalink
8306584: Start of release updates for JDK 22
Browse files Browse the repository at this point in the history
8306585: Add SourceVersion.RELEASE_22
8306586: Add source 22 and target 22 to javac

Reviewed-by: erikj, iris, dholmes, jlahoda, alanb
  • Loading branch information
jddarcy authored and JesperIRL committed Jun 8, 2023
1 parent bb377b2 commit 5a706fb
Show file tree
Hide file tree
Showing 69 changed files with 5,954 additions and 52 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=21
version=22

[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=21
DEFAULT_VERSION_FEATURE=22
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-09-19
DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_DATE=2024-03-19
DEFAULT_VERSION_CLASSFILE_MAJOR=66 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="20 21"
DEFAULT_JDK_SOURCE_TARGET_VERSION=21
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="20 21 22"
DEFAULT_JDK_SOURCE_TARGET_VERSION=22
DEFAULT_PROMOTED_VERSION_PRE=ea
Original file line number Diff line number Diff line change
Expand Up @@ -3700,8 +3700,8 @@ public boolean read(LineBasedReader reader) throws IOException {
Function<String, MethodParam> string2Param =
p -> {
int sep = p.indexOf(':');
return new MethodParam(Integer.parseInt(p.substring(0, sep)),
p.substring(sep + 1));
return new MethodParam(Integer.parseInt(p.substring(0, sep), 16),
p.substring(sep + 1));
};
methodParameters =
deserializeList(inMethodParameters).stream()
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/classfile/classFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@

#define JAVA_21_VERSION 65

#define JAVA_22_VERSION 66

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 @@ -281,7 +281,20 @@ public enum ClassFileFormatVersion {
* 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);
RELEASE_21(65),

/**
* The version introduced by the Java Platform, Standard Edition
* 22.
*
* @since 22
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jvms/se22/html/index.html">
* <cite>The Java Virtual Machine Specification, Java SE 22 Edition</cite></a>
*/
RELEASE_22(66),
; // Reduce code churn when appending new constants

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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, 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
Expand Down Expand Up @@ -606,8 +606,9 @@ public static void buildModuleTo(Path path,
public static final int JAVA_19_VERSION = 63;
public static final int JAVA_20_VERSION = 64;
public static final int JAVA_21_VERSION = 65;
public static final int JAVA_22_VERSION = 66;

public static final int LATEST_MAJOR_VERSION = JAVA_21_VERSION;
public static final int LATEST_MAJOR_VERSION = JAVA_22_VERSION;
public static final int LATEST_MINOR_VERSION = 0;
public static final int PREVIEW_MINOR_VERSION = -1;

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.V21) {
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V22) {
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 @@ -311,6 +311,7 @@ public interface Opcodes {
int V19 = 0 << 16 | 63;
int V20 = 0 << 16 | 64;
int V21 = 0 << 16 | 65;
int V22 = 0 << 16 | 66;

/**
* Version flag indicating that the class is using 'preview' features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public enum SourceVersion {
* 21: pattern matching for switch and record patterns (string
* templates in preview, unnamed patterns and variables in
* preview, unnamed classes and instance main methods in preview)
* 22: tbd
*/

/**
Expand Down Expand Up @@ -395,7 +396,20 @@ public enum SourceVersion {
* @see <a href="https://openjdk.org/jeps/441">
* Pattern Matching for switch</a>
*/
RELEASE_21;
RELEASE_21,

/**
* The version introduced by the Java Platform, Standard Edition
* 22.
*
* @since 22
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jls/se22/html/index.html">
* <cite>The Java Language Specification, Java SE 22 Edition</cite></a>
*/
RELEASE_22,
; // Reduce code churn when appending new constants

// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
Expand All @@ -404,7 +418,7 @@ public enum SourceVersion {
* {@return the latest source version that can be modeled}
*/
public static SourceVersion latest() {
return RELEASE_21;
return RELEASE_22;
}

private static final SourceVersion latestSupported = getLatestSupported();
Expand All @@ -419,7 +433,7 @@ public static SourceVersion latest() {
private static SourceVersion getLatestSupported() {
int intVersion = Runtime.version().feature();
return (intVersion >= 11) ?
valueOf("RELEASE_" + Math.min(21, intVersion)):
valueOf("RELEASE_" + Math.min(22, 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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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_21)
@SupportedSourceVersion(RELEASE_22)
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 @@ -132,7 +132,13 @@ public enum Source {
/**
* 21, tbd
*/
JDK21("21");
JDK21("21"),

/**
* 22, tbd
*/
JDK22("22"),
; // Reduce code churn when appending new constants

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

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

public Target requiredTarget() {
return switch(this) {
case JDK22 -> Target.JDK1_22;
case JDK21 -> Target.JDK1_21;
case JDK20 -> Target.JDK1_20;
case JDK19 -> Target.JDK1_19;
Expand Down Expand Up @@ -324,6 +331,7 @@ public static SourceVersion toSourceVersion(Source source) {
case JDK19 -> RELEASE_19;
case JDK20 -> RELEASE_20;
case JDK21 -> RELEASE_21;
case JDK22 -> RELEASE_22;
default -> null;
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, 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
Expand Down Expand Up @@ -123,7 +123,9 @@ public enum Version {
V62(62, 0), // JDK 18
V63(63, 0), // JDK 19
V64(64, 0), // JDK 20
V65(65, 0); // JDK 21
V65(65, 0), // JDK 21
V66(66, 0), // JDK 22
; // Reduce code churn when appending new constants
Version(int major, int minor) {
this.major = major;
this.minor = minor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -97,7 +97,11 @@ public enum Target {
JDK1_20("20", 64, 0),

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

/** JDK 22. */
JDK1_22("22", 66, 0),
; // Reduce code churn when appending new constants

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_21)
@SupportedSourceVersion(SourceVersion.RELEASE_22)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;

Expand Down
Loading

0 comments on commit 5a706fb

Please sign in to comment.