8330182: Start of release updates for JDK 24

8330183: Add SourceVersion.RELEASE_24
8330184: Add source 24 and target 24 to javac

Reviewed-by: iris, vromero, asotona, dholmes
This commit is contained in:
Joe Darcy 2024-06-06 16:01:57 +00:00 committed by Jesper Wilhelmsson
parent 054362abe0
commit 75dc2f8518
50 changed files with 2076 additions and 64 deletions

View file

@ -1481,6 +1481,12 @@ public sealed interface ClassFile
*/
int JAVA_23_VERSION = 67;
/**
* The class major version of JAVA_24.
* @since 24
*/
int JAVA_24_VERSION = 68;
/**
* A minor version number indicating a class uses preview features
* of a Java SE version since 12, for major versions {@value
@ -1492,7 +1498,7 @@ public sealed interface ClassFile
* {@return the latest major Java version}
*/
static int latestMajorVersion() {
return JAVA_23_VERSION;
return JAVA_24_VERSION;
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, 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
@ -306,6 +306,18 @@ public enum ClassFileFormatVersion {
* <cite>The Java Virtual Machine Specification, Java SE 23 Edition</cite></a>
*/
RELEASE_23(67),
/**
* The version introduced by the Java Platform, Standard Edition
* 24.
*
* @since 24
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jvms/se24/html/index.html">
* <cite>The Java Virtual Machine Specification, Java SE 24 Edition</cite></a>
*/
RELEASE_24(68),
; // Reduce code churn when appending new constants
// Note to maintainers: when adding constants for newer releases,
@ -321,7 +333,7 @@ public enum ClassFileFormatVersion {
* {@return the latest class file format version}
*/
public static ClassFileFormatVersion latest() {
return RELEASE_23;
return RELEASE_24;
}
/**

View file

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

View file

@ -313,6 +313,7 @@ public interface Opcodes {
int V21 = 0 << 16 | 65;
int V22 = 0 << 16 | 66;
int V23 = 0 << 16 | 67;
int V24 = 0 << 16 | 68;
/**
* Version flag indicating that the class is using 'preview' features.