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

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


The following commit(s) were added to refs/heads/main by this push:
     new a926a2c806 Simplify construction of Jre22Compat
a926a2c806 is described below

commit a926a2c8065735373dcbe10489f8538cc42d5993
Author: Mark Thomas <[email protected]>
AuthorDate: Thu May 21 08:45:02 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
---
 .../org/apache/tomcat/util/compat/Jre22Compat.java | 22 +---------------------
 .../tomcat/util/compat/LocalStrings.properties     | 18 ------------------
 .../tomcat/util/compat/LocalStrings_fr.properties  | 21 ---------------------
 .../tomcat/util/compat/LocalStrings_ja.properties  | 21 ---------------------
 4 files changed, 1 insertion(+), 81 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java 
b/java/org/apache/tomcat/util/compat/Jre22Compat.java
index 698b80f305..b422eae75b 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,30 +27,14 @@ public class Jre22Compat extends JreCompat {
     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() {
         return supported;
     }
-
 }
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings.properties
deleted file mode 100644
index 51e2b7fc84..0000000000
--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-jre22Compat.javaPre22=Class not found so assuming code is running on a 
pre-Java 22 JVM
-
-jre24Compat.javaPre24=Method not found so assuming code is running on a 
pre-Java 24 JVM
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties
deleted file mode 100644
index 4c54681a66..0000000000
--- a/java/org/apache/tomcat/util/compat/LocalStrings_fr.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Do not edit this file directly.
-# To edit translations see: 
https://tomcat.apache.org/getinvolved.html#Translations
-
-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
-
-jre24Compat.javaPre24=Le code est considéré être exécuté sur une JVM 
antérieure à Java 24 car la méthode 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
deleted file mode 100644
index 66376b8427..0000000000
--- a/java/org/apache/tomcat/util/compat/LocalStrings_ja.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Do not edit this file directly.
-# To edit translations see: 
https://tomcat.apache.org/getinvolved.html#Translations
-
-jre22Compat.javaPre22=クラスが見つからないため、コードが Java 22 以前の JVM で実行されていると仮定します
-
-jre24Compat.javaPre24=メソッドが見つからないため、コードはJava 24以前のJVMで実行されていると想定されます


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

Reply via email to