From 6dbc7e9a5123c4ad22b58305fc117e2252c62808 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 24 Aug 2026 15:47:34 +0100 Subject: [PATCH] Use method on String to identify Java 27 At the time of writing, https://javaalmanac.io lists EnumSet.spliterator as being new in Java 27, but that's not the case. This commit switches to using String.encodedLength(Charset) instead. This method is new in Java 27 and also aligns with the existing TWENTY_SIX value that already uses a method on String for version identification. See gh-51422 --- .../java/org/springframework/boot/system/JavaVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java b/core/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java index b47a9a2d8e8..b62b9e3f811 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java @@ -18,11 +18,11 @@ package org.springframework.boot.system; import java.io.Console; import java.io.Reader; +import java.nio.charset.Charset; import java.text.NumberFormat; import java.time.Duration; import java.util.Arrays; import java.util.Collections; -import java.util.EnumSet; import java.util.List; import java.util.SortedSet; import java.util.concurrent.Future; @@ -107,7 +107,7 @@ public enum JavaVersion { * Java 27. * @since 4.0.9 */ - TWENTY_SEVEN("27", EnumSet.class, "spliterator"); + TWENTY_SEVEN("27", String.class, "encodedLength", Charset.class); private final String name;