Merge branch '3.4.x'
Closes gh-44210
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.system;
|
||||
|
||||
import java.io.Console;
|
||||
import java.io.Reader;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
@@ -77,15 +78,21 @@ public enum JavaVersion {
|
||||
* Java 23.
|
||||
* @since 3.2.9
|
||||
*/
|
||||
TWENTY_THREE("23", NumberFormat.class, "isStrict");
|
||||
TWENTY_THREE("23", NumberFormat.class, "isStrict"),
|
||||
|
||||
/**
|
||||
* Java 24.
|
||||
* @since 3.4.3
|
||||
*/
|
||||
TWENTY_FOUR("24", Reader.class, "of", CharSequence.class);
|
||||
|
||||
private final String name;
|
||||
|
||||
private final boolean available;
|
||||
|
||||
JavaVersion(String name, Class<?> versionSpecificClass, String versionSpecificMethod) {
|
||||
JavaVersion(String name, Class<?> versionSpecificClass, String versionSpecificMethod, Class<?>... paramTypes) {
|
||||
this.name = name;
|
||||
this.available = ClassUtils.hasMethod(versionSpecificClass, versionSpecificMethod);
|
||||
this.available = ClassUtils.hasMethod(versionSpecificClass, versionSpecificMethod, paramTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -121,4 +121,10 @@ class JavaVersionTests {
|
||||
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.TWENTY_THREE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledOnJre(JRE.JAVA_24)
|
||||
void currentJavaVersionTwentyFour() {
|
||||
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.TWENTY_FOUR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user