Browse Source

Merge branch '3.4.x'

Closes gh-44210
pull/44223/head
Andy Wilkinson 1 year ago
parent
commit
8dc21cf219
  1. 15
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java
  2. 8
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java

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

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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 { @@ -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

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

@ -1,5 +1,5 @@ @@ -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 { @@ -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);
}
}

Loading…
Cancel
Save