Skip to content

Commit 8dc21cf

Browse files
committed
Merge branch '3.4.x'
Closes gh-44210
2 parents 7c27cc5 + c5d21e0 commit 8dc21cf

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.system;
1818

1919
import java.io.Console;
20+
import java.io.Reader;
2021
import java.text.NumberFormat;
2122
import java.time.Duration;
2223
import java.util.Arrays;
@@ -77,15 +78,21 @@ public enum JavaVersion {
7778
* Java 23.
7879
* @since 3.2.9
7980
*/
80-
TWENTY_THREE("23", NumberFormat.class, "isStrict");
81+
TWENTY_THREE("23", NumberFormat.class, "isStrict"),
82+
83+
/**
84+
* Java 24.
85+
* @since 3.4.3
86+
*/
87+
TWENTY_FOUR("24", Reader.class, "of", CharSequence.class);
8188

8289
private final String name;
8390

8491
private final boolean available;
8592

86-
JavaVersion(String name, Class<?> versionSpecificClass, String versionSpecificMethod) {
93+
JavaVersion(String name, Class<?> versionSpecificClass, String versionSpecificMethod, Class<?>... paramTypes) {
8794
this.name = name;
88-
this.available = ClassUtils.hasMethod(versionSpecificClass, versionSpecificMethod);
95+
this.available = ClassUtils.hasMethod(versionSpecificClass, versionSpecificMethod, paramTypes);
8996
}
9097

9198
@Override

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -121,4 +121,10 @@ void currentJavaVersionTwentyThree() {
121121
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.TWENTY_THREE);
122122
}
123123

124+
@Test
125+
@EnabledOnJre(JRE.JAVA_24)
126+
void currentJavaVersionTwentyFour() {
127+
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.TWENTY_FOUR);
128+
}
129+
124130
}

0 commit comments

Comments
 (0)