8306584: Start of release updates for JDK 22

8306585: Add SourceVersion.RELEASE_22
8306586: Add source 22 and target 22 to javac

Reviewed-by: erikj, iris, dholmes, jlahoda, alanb
This commit is contained in:
Joe Darcy 2023-06-08 16:02:21 +00:00 committed by Jesper Wilhelmsson
parent bb377b2673
commit 5a706fb403
69 changed files with 5954 additions and 52 deletions

View file

@ -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.
@ -296,7 +309,7 @@ public enum ClassFileFormatVersion {
* {@return the latest class file format version}
*/
public static ClassFileFormatVersion latest() {
return RELEASE_21;
return RELEASE_22;
}
/**

View file

@ -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
@ -606,8 +606,9 @@ public class Classfile {
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;

View file

@ -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.V21) {
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V22) {
throw new IllegalArgumentException(
"Unsupported class file major version " + readShort(classFileOffset + 6));
}

View file

@ -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.