Skip to content

Commit

Permalink
8330182: Start of release updates for JDK 24
Browse files Browse the repository at this point in the history
8330183: Add SourceVersion.RELEASE_24
8330184: Add source 24 and target 24 to javac

Reviewed-by: iris, vromero, asotona, dholmes
  • Loading branch information
jddarcy authored and JesperIRL committed Jun 6, 2024
1 parent 054362a commit 75dc2f8
Show file tree
Hide file tree
Showing 50 changed files with 2,076 additions and 64 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=23
version=24

[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=23
DEFAULT_VERSION_FEATURE=24
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=2024-09-17
DEFAULT_VERSION_CLASSFILE_MAJOR=67 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_DATE=2025-03-18
DEFAULT_VERSION_CLASSFILE_MAJOR=68 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="22 23"
DEFAULT_JDK_SOURCE_TARGET_VERSION=23
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="22 23 24"
DEFAULT_JDK_SOURCE_TARGET_VERSION=24
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 @@ -151,6 +151,8 @@

#define JAVA_23_VERSION 67

#define JAVA_24_VERSION 68

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 @@ -1481,6 +1481,12 @@ default List<VerifyError> verify(Path path) throws IOException {
*/
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
Expand All @@ -1492,7 +1498,7 @@ default List<VerifyError> verify(Path path) throws IOException {
* {@return the latest major Java version}
*/
static int latestMajorVersion() {
return JAVA_23_VERSION;
return JAVA_24_VERSION;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -321,7 +333,7 @@ private ClassFileFormatVersion(int major) {
* {@return the latest class file format version}
*/
public static ClassFileFormatVersion latest() {
return RELEASE_23;
return RELEASE_24;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,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.V23) {
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V24) {
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 @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
Expand Down Expand Up @@ -427,6 +427,18 @@ public enum SourceVersion {
* <cite>The Java Language Specification, Java SE 23 Edition</cite></a>
*/
RELEASE_23,

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

// Note that when adding constants for newer releases, the
Expand All @@ -436,7 +448,7 @@ public enum SourceVersion {
* {@return the latest source version that can be modeled}
*/
public static SourceVersion latest() {
return RELEASE_23;
return RELEASE_24;
}

private static final SourceVersion latestSupported = getLatestSupported();
Expand All @@ -451,7 +463,7 @@ public static SourceVersion latest() {
private static SourceVersion getLatestSupported() {
int intVersion = Runtime.version().feature();
return (intVersion >= 11) ?
valueOf("RELEASE_" + Math.min(23, intVersion)):
valueOf("RELEASE_" + Math.min(24, 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_23)
@SupportedSourceVersion(RELEASE_24)
public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* @see AbstractAnnotationValueVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public abstract class AbstractAnnotationValueVisitorPreview<R, P> extends AbstractAnnotationValueVisitor14<R, P> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @see AbstractElementVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -56,7 +56,7 @@
* @see AbstractElementVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public abstract class AbstractElementVisitorPreview<R, P> extends AbstractElementVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @see AbstractTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -54,7 +54,7 @@
* @see AbstractTypeVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public abstract class AbstractTypeVisitorPreview<R, P> extends AbstractTypeVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @see ElementKindVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -68,7 +68,7 @@
* @see ElementKindVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class ElementKindVisitorPreview<R, P> extends ElementKindVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
* @see ElementScanner9
* @since 16
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -85,7 +85,7 @@
* @see ElementScanner14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class ElementScannerPreview<R, P> extends ElementScanner14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @see SimpleAnnotationValueVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -59,7 +59,7 @@
* @see SimpleAnnotationValueVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class SimpleAnnotationValueVisitorPreview<R, P> extends SimpleAnnotationValueVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* @see SimpleElementVisitor9
* @since 16
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -64,7 +64,7 @@
* @see SimpleElementVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class SimpleElementVisitorPreview<R, P> extends SimpleElementVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* @see SimpleTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -63,7 +63,7 @@
* @see SimpleTypeVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class SimpleTypeVisitorPreview<R, P> extends SimpleTypeVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @see TypeKindVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
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 @@ -67,7 +67,7 @@
* @see TypeKindVisitor14
* @since 23
*/
@SupportedSourceVersion(RELEASE_23)
@SupportedSourceVersion(RELEASE_24)
@PreviewFeature(feature=PreviewFeature.Feature.LANGUAGE_MODEL, reflective=true)
public class TypeKindVisitorPreview<R, P> extends TypeKindVisitor14<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public enum Source {
* 23, tbd
*/
JDK23("23"),

/**
* 24, tbd
*/
JDK24("24"),
; // Reduce code churn when appending new constants

private static final Context.Key<Source> sourceKey = new Context.Key<>();
Expand Down Expand Up @@ -195,6 +200,7 @@ public boolean isSupported() {

public Target requiredTarget() {
return switch(this) {
case JDK24 -> Target.JDK1_24;
case JDK23 -> Target.JDK1_23;
case JDK22 -> Target.JDK1_22;
case JDK21 -> Target.JDK1_21;
Expand Down Expand Up @@ -341,6 +347,7 @@ public static SourceVersion toSourceVersion(Source source) {
case JDK21 -> RELEASE_21;
case JDK22 -> RELEASE_22;
case JDK23 -> RELEASE_23;
case JDK24 -> RELEASE_24;
default -> null;
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
Expand Down Expand Up @@ -126,6 +126,7 @@ public enum Version {
V65(65, 0), // JDK 21
V66(66, 0), // JDK 22
V67(67, 0), // JDK 23
V68(68, 0), // JDK 24
; // Reduce code churn when appending new constants
Version(int major, int minor) {
this.major = major;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
Expand Down Expand Up @@ -104,6 +104,9 @@ public enum Target {

/** JDK 23. */
JDK1_23("23", 67, 0),

/** JDK 24. */
JDK1_24("24", 68, 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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
Expand Down Expand Up @@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_23)
@SupportedSourceVersion(SourceVersion.RELEASE_24)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;

Expand Down
Loading

0 comments on commit 75dc2f8

Please sign in to comment.