This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 68a001a2b2 Simplify construction of Jre22Compat
68a001a2b2 is described below

commit 68a001a2b25f5cade3652c8e8bd8eae7670f609b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu May 21 08:49:28 2026 +0100

    Simplify construction of Jre22Compat
    
    Retain JreCompat architecture:
    - for consistency with Tomcat 9 where Runtime.version() is not available
    - so support for Java 22 specific methods can be added if required
---
 java/org/apache/tomcat/util/compat/Jre22Compat.java | 21 +--------------------
 .../tomcat/util/compat/LocalStrings.properties      |  2 --
 .../tomcat/util/compat/LocalStrings_fr.properties   |  2 --
 .../tomcat/util/compat/LocalStrings_ja.properties   |  2 --
 4 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java 
b/java/org/apache/tomcat/util/compat/Jre22Compat.java
index fec9431909..60f253a724 100644
--- a/java/org/apache/tomcat/util/compat/Jre22Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre22Compat.java
@@ -16,10 +16,6 @@
  */
 package org.apache.tomcat.util.compat;
 
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.res.StringManager;
-
 /**
  * JRE 22 compatibility implementation.
  */
@@ -31,26 +27,11 @@ public class Jre22Compat extends Jre21Compat {
     public Jre22Compat() {
     }
 
-    private static final Log log = LogFactory.getLog(Jre22Compat.class);
-    private static final StringManager sm = 
StringManager.getManager(Jre22Compat.class);
-
     private static final boolean supported;
 
 
     static {
-        // Note: FFM is the main new feature from Java 22, but it was 
previously
-        // present as a preview. As a result, it is more accurate to test for 
another
-        // new class
-        Class<?> c1 = null;
-        try {
-            c1 = Class.forName("java.text.ListFormat");
-        } catch (ClassNotFoundException e) {
-            // Must be pre-Java 22
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jre22Compat.javaPre22"), e);
-            }
-        }
-        supported = (c1 != null);
+        supported = Runtime.version().feature() > 21;
     }
 
     static boolean isSupported() {
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings.properties
index a4da389b25..8e9aa3d96a 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings.properties
@@ -18,8 +18,6 @@
 
 jre18Compat.javaPre18=Method not found so assuming code is running on a 
pre-Java 18 JVM
 
-jre22Compat.javaPre22=Class not found so assuming code is running on a 
pre-Java 22 JVM
-
 jreCompat.useCanonCaches.failed=Failed to set the 
java.io.FileSystem.useCanonCaches static field
 jreCompat.useCanonCaches.init=Unable to create a reference to the 
java.io.FileSystem.useCanonCaches static field
 jreCompat.useCanonCaches.java18=If using Java 18 to Java 20 inclusive, you 
must not enabled the canonical file name cache using 
-Dsun.io.useCanonCaches=true on the command line as Tomcat is unable to disable 
the cache via reflection on those Java versions
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties
index 7ce5bd47d8..be4c9b25c7 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties
@@ -17,5 +17,3 @@
 # To edit translations see: 
https://tomcat.apache.org/getinvolved.html#Translations
 
 jre18Compat.javaPre18=Le code est considéré être exécuté sur une JVM 
antérieure à Java 18 car la méthode n'a pas été trouvée
-
-jre22Compat.javaPre22=Le code est considéré être exécuté sur une JVM 
antérieure à Java 22 car la classe n'a pas été trouvée
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings_ja.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings_ja.properties
index ffdd6cd7e1..049fc2f49a 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings_ja.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings_ja.properties
@@ -17,5 +17,3 @@
 # To edit translations see: 
https://tomcat.apache.org/getinvolved.html#Translations
 
 jre18Compat.javaPre18=メソッドが見つからないため、Java 18 以前の JVM で実行されていると仮定します
-
-jre22Compat.javaPre22=クラスが見つからないため、コードが Java 22 以前の JVM で実行されていると仮定します


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to