Skip to content

Commit 351f22c

Browse files
[GR-54591] Merge in tag jdk-24+1
PullRequest: labsjdk-ce/80
2 parents f35673a + e41e8e5 commit 351f22c

File tree

55 files changed

+2200
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2200
-125
lines changed

.jcheck/conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[general]
22
project=jdk
33
jbs=JDK
4-
version=23
4+
version=24
55

66
[checks]
77
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists

make/conf/version-numbers.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
# Default version, product, and vendor information to use,
2727
# unless overridden by configure
2828

29-
DEFAULT_VERSION_FEATURE=23
29+
DEFAULT_VERSION_FEATURE=24
3030
DEFAULT_VERSION_INTERIM=0
3131
DEFAULT_VERSION_UPDATE=0
3232
DEFAULT_VERSION_PATCH=0
3333
DEFAULT_VERSION_EXTRA1=0
3434
DEFAULT_VERSION_EXTRA2=0
3535
DEFAULT_VERSION_EXTRA3=0
36-
DEFAULT_VERSION_DATE=2024-09-17
37-
DEFAULT_VERSION_CLASSFILE_MAJOR=67 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
36+
DEFAULT_VERSION_DATE=2025-03-18
37+
DEFAULT_VERSION_CLASSFILE_MAJOR=68 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
3838
DEFAULT_VERSION_CLASSFILE_MINOR=0
3939
DEFAULT_VERSION_DOCS_API_SINCE=11
40-
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="22 23"
41-
DEFAULT_JDK_SOURCE_TARGET_VERSION=23
40+
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="22 23 24"
41+
DEFAULT_JDK_SOURCE_TARGET_VERSION=24
4242
DEFAULT_PROMOTED_VERSION_PRE=ea

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151

152152
#define JAVA_23_VERSION 67
153153

154+
#define JAVA_24_VERSION 68
155+
154156
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
155157
assert((bad_constant == JVM_CONSTANT_Module ||
156158
bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION,

src/java.base/share/classes/java/lang/classfile/ClassFile.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,12 @@ default List<VerifyError> verify(Path path) throws IOException {
14811481
*/
14821482
int JAVA_23_VERSION = 67;
14831483

1484+
/**
1485+
* The class major version of JAVA_24.
1486+
* @since 24
1487+
*/
1488+
int JAVA_24_VERSION = 68;
1489+
14841490
/**
14851491
* A minor version number indicating a class uses preview features
14861492
* of a Java SE version since 12, for major versions {@value
@@ -1492,7 +1498,7 @@ default List<VerifyError> verify(Path path) throws IOException {
14921498
* {@return the latest major Java version}
14931499
*/
14941500
static int latestMajorVersion() {
1495-
return JAVA_23_VERSION;
1501+
return JAVA_24_VERSION;
14961502
}
14971503

14981504
/**

src/java.base/share/classes/java/lang/reflect/ClassFileFormatVersion.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -306,6 +306,18 @@ public enum ClassFileFormatVersion {
306306
* <cite>The Java Virtual Machine Specification, Java SE 23 Edition</cite></a>
307307
*/
308308
RELEASE_23(67),
309+
310+
/**
311+
* The version introduced by the Java Platform, Standard Edition
312+
* 24.
313+
*
314+
* @since 24
315+
*
316+
* @see <a
317+
* href="https://docs.oracle.com/javase/specs/jvms/se24/html/index.html">
318+
* <cite>The Java Virtual Machine Specification, Java SE 24 Edition</cite></a>
319+
*/
320+
RELEASE_24(68),
309321
; // Reduce code churn when appending new constants
310322

311323
// Note to maintainers: when adding constants for newer releases,
@@ -321,7 +333,7 @@ private ClassFileFormatVersion(int major) {
321333
* {@return the latest class file format version}
322334
*/
323335
public static ClassFileFormatVersion latest() {
324-
return RELEASE_23;
336+
return RELEASE_24;
325337
}
326338

327339
/**

src/java.base/share/classes/java/text/CompactNumberFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ public Number parse(String text, ParsePosition pos) {
17361736
// If parse integer only is true and the parsing is broken at
17371737
// decimal point, then pass/ignore all digits and move pointer
17381738
// at the start of suffix, to process the suffix part
1739-
if (isParseIntegerOnly()
1739+
if (isParseIntegerOnly() && position < text.length()
17401740
&& text.charAt(position) == symbols.getDecimalSeparator()) {
17411741
position++; // Pass decimal character
17421742
for (; position < text.length(); ++position) {

src/java.base/share/classes/java/util/zip/Deflater.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,7 @@
5757
* The following code fragment demonstrates a trivial compression
5858
* and decompression of a string using {@code Deflater} and
5959
* {@code Inflater}.
60-
*
61-
* <blockquote><pre>
62-
* try {
63-
* // Encode a String into bytes
64-
* String inputString = "blahblahblah";
65-
* byte[] input = inputString.getBytes("UTF-8");
66-
*
67-
* // Compress the bytes
68-
* byte[] output = new byte[100];
69-
* Deflater compresser = new Deflater();
70-
* compresser.setInput(input);
71-
* compresser.finish();
72-
* int compressedDataLength = compresser.deflate(output);
73-
* compresser.end();
74-
*
75-
* // Decompress the bytes
76-
* Inflater decompresser = new Inflater();
77-
* decompresser.setInput(output, 0, compressedDataLength);
78-
* byte[] result = new byte[100];
79-
* int resultLength = decompresser.inflate(result);
80-
* decompresser.end();
81-
*
82-
* // Decode the bytes into a String
83-
* String outputString = new String(result, 0, resultLength, "UTF-8");
84-
* } catch (java.io.UnsupportedEncodingException ex) {
85-
* // handle
86-
* } catch (java.util.zip.DataFormatException ex) {
87-
* // handle
88-
* }
89-
* </pre></blockquote>
60+
* {@snippet id="compdecomp" lang="java" class="Snippets" region="DeflaterInflaterExample"}
9061
*
9162
* @apiNote
9263
* To release resources used by this {@code Deflater}, the {@link #end()} method

src/java.base/share/classes/java/util/zip/Inflater.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,7 @@
5656
* The following code fragment demonstrates a trivial compression
5757
* and decompression of a string using {@code Deflater} and
5858
* {@code Inflater}.
59-
*
60-
* <blockquote><pre>
61-
* try {
62-
* // Encode a String into bytes
63-
* String inputString = "blahblahblah\u20AC\u20AC";
64-
* byte[] input = inputString.getBytes("UTF-8");
65-
*
66-
* // Compress the bytes
67-
* byte[] output = new byte[100];
68-
* Deflater compresser = new Deflater();
69-
* compresser.setInput(input);
70-
* compresser.finish();
71-
* int compressedDataLength = compresser.deflate(output);
72-
*
73-
* // Decompress the bytes
74-
* Inflater decompresser = new Inflater();
75-
* decompresser.setInput(output, 0, compressedDataLength);
76-
* byte[] result = new byte[100];
77-
* int resultLength = decompresser.inflate(result);
78-
* decompresser.end();
79-
*
80-
* // Decode the bytes into a String
81-
* String outputString = new String(result, 0, resultLength, "UTF-8");
82-
* } catch (java.io.UnsupportedEncodingException ex) {
83-
* // handle
84-
* } catch (java.util.zip.DataFormatException ex) {
85-
* // handle
86-
* }
87-
* </pre></blockquote>
59+
* {@snippet id="compdecomp" lang="java" class="Snippets" region="DeflaterInflaterExample"}
8860
*
8961
* @apiNote
9062
* To release resources used by this {@code Inflater}, the {@link #end()} method
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package java.util.zip;
26+
27+
import java.io.ByteArrayOutputStream;
28+
import java.nio.charset.StandardCharsets;
29+
30+
class Snippets {
31+
32+
void deflaterInflaterExample() {
33+
// @start region="DeflaterInflaterExample"
34+
35+
// Encode a String into bytes
36+
String inputString = "blahblahblah\u20AC\u20AC";
37+
byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
38+
39+
// Compress the bytes
40+
ByteArrayOutputStream compressedBaos = new ByteArrayOutputStream();
41+
Deflater compressor = new Deflater();
42+
try {
43+
compressor.setInput(input);
44+
// Let the compressor know that the complete input
45+
// has been made available
46+
compressor.finish();
47+
// Keep compressing the input till the compressor
48+
// is finished compressing
49+
while (!compressor.finished()) {
50+
// Use some reasonable size for the temporary buffer
51+
// based on the data being compressed
52+
byte[] tmpBuffer = new byte[100];
53+
int numCompressed = compressor.deflate(tmpBuffer);
54+
// Copy over the compressed bytes from the temporary
55+
// buffer into the final byte array
56+
compressedBaos.write(tmpBuffer, 0, numCompressed);
57+
}
58+
} finally {
59+
// Release the resources held by the compressor
60+
compressor.end();
61+
}
62+
63+
// Decompress the bytes
64+
Inflater decompressor = new Inflater();
65+
ByteArrayOutputStream decompressedBaos = new ByteArrayOutputStream();
66+
try {
67+
byte[] compressed = compressedBaos.toByteArray();
68+
decompressor.setInput(compressed, 0, compressed.length);
69+
while (!decompressor.finished()) {
70+
// Use some reasonable size for the temporary buffer,
71+
// based on the data being decompressed; in this example,
72+
// we use a small buffer size
73+
byte[] tmpBuffer = new byte[100];
74+
int numDecompressed = 0;
75+
try {
76+
numDecompressed = decompressor.inflate(tmpBuffer);
77+
} catch (DataFormatException dfe) {
78+
// Handle the exception suitably, in this example
79+
// we just rethrow it
80+
throw new RuntimeException(dfe);
81+
}
82+
// Copy over the decompressed bytes from the temporary
83+
// buffer into the final byte array
84+
decompressedBaos.write(tmpBuffer, 0, numDecompressed);
85+
}
86+
} finally {
87+
// Release the resources held by the decompressor
88+
decompressor.end();
89+
}
90+
// Decode the bytes into a String
91+
String outputString = decompressedBaos.toString(StandardCharsets.UTF_8);
92+
93+
// @end
94+
}
95+
96+
}

src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public ClassReader(
227227
this.b = classFileBuffer;
228228
// Check the class' major_version. This field is after the magic and minor_version fields, which
229229
// use 4 and 2 bytes respectively.
230-
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V23) {
230+
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V24) {
231231
throw new IllegalArgumentException(
232232
"Unsupported class file major version " + readShort(classFileOffset + 6));
233233
}

0 commit comments

Comments
 (0)