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 1dc0ddd378 No need to Jre24Compat if only need to test version number
1dc0ddd378 is described below

commit 1dc0ddd3788ed85dcafe99ba339cff58603a2eac
Author: Mark Thomas <[email protected]>
AuthorDate: Thu May 21 08:35:11 2026 +0100

    No need to Jre24Compat if only need to test version number
---
 .../org/apache/tomcat/util/compat/Jre24Compat.java | 60 ----------------------
 java/org/apache/tomcat/util/compat/JreCompat.java  | 19 +------
 test/org/apache/el/parser/TestAstIdentifier.java   |  5 +-
 3 files changed, 3 insertions(+), 81 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre24Compat.java 
b/java/org/apache/tomcat/util/compat/Jre24Compat.java
deleted file mode 100644
index 35ca70854e..0000000000
--- a/java/org/apache/tomcat/util/compat/Jre24Compat.java
+++ /dev/null
@@ -1,60 +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.
- */
-package org.apache.tomcat.util.compat;
-
-import java.lang.reflect.Method;
-import java.time.Duration;
-
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.res.StringManager;
-
-/**
- * JRE 24 compatibility implementation.
- */
-public class Jre24Compat extends Jre22Compat {
-
-    /**
-     * Constructs a new Jre24Compat.
-     */
-    public Jre24Compat() {
-    }
-
-    private static final Log log = LogFactory.getLog(Jre24Compat.class);
-    private static final StringManager sm = 
StringManager.getManager(Jre24Compat.class);
-
-    private static final boolean supported;
-
-
-    static {
-        Method m1 = null;
-        try {
-            m1 = Process.class.getMethod("waitFor", Duration.class);
-        } catch (NoSuchMethodException e) {
-            // Must be pre-Java 24
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jre22Compat.javaPre24"), e);
-            }
-        }
-        supported = (m1 != null);
-    }
-
-    static boolean isSupported() {
-        return supported;
-    }
-
-}
diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java 
b/java/org/apache/tomcat/util/compat/JreCompat.java
index 1aba953632..be005d511d 100644
--- a/java/org/apache/tomcat/util/compat/JreCompat.java
+++ b/java/org/apache/tomcat/util/compat/JreCompat.java
@@ -30,7 +30,6 @@ public class JreCompat {
 
     private static final JreCompat instance;
     private static final boolean graalAvailable;
-    private static final boolean jre24Available;
     private static final boolean jre22Available;
 
     static {
@@ -47,17 +46,11 @@ public class JreCompat {
 
         // This is Tomcat 12.0.x with a minimum Java version of Java 21.
         // Look for the highest supported JVM first
-        if (Jre24Compat.isSupported()) {
-            instance = new Jre24Compat();
-            jre24Available = true;
-            jre22Available = true;
-        } else if (Jre22Compat.isSupported()) {
+        if (Jre22Compat.isSupported()) {
             instance = new Jre22Compat();
-            jre24Available = false;
             jre22Available = true;
         } else {
             instance = new JreCompat();
-            jre24Available = false;
             jre22Available = false;
         }
     }
@@ -91,14 +84,4 @@ public class JreCompat {
     public static boolean isJre22Available() {
         return jre22Available;
     }
-
-
-    /**
-     * Check if JRE 24 is available.
-     *
-     * @return {@code true} if JRE 24 is available
-     */
-    public static boolean isJre24Available() {
-        return jre24Available;
-    }
 }
diff --git a/test/org/apache/el/parser/TestAstIdentifier.java 
b/test/org/apache/el/parser/TestAstIdentifier.java
index 5d94478624..b7ad39f3ed 100644
--- a/test/org/apache/el/parser/TestAstIdentifier.java
+++ b/test/org/apache/el/parser/TestAstIdentifier.java
@@ -27,7 +27,6 @@ import org.junit.Assume;
 import org.junit.Test;
 
 import org.apache.jasper.el.ELContextImpl;
-import org.apache.tomcat.util.compat.JreCompat;
 
 public class TestAstIdentifier {
 
@@ -62,7 +61,7 @@ public class TestAstIdentifier {
          *
          * In Java 24, the definition of Java Letter and/or Java Digit has 
changed.
          */
-        Assume.assumeFalse(JreCompat.isJre24Available());
+        Assume.assumeTrue(Runtime.version().feature() < 24);
         for (int i = 0; i < 0xFFFF; i++) {
             if (Character.isJavaIdentifierStart(i)) {
                 testIdentifier((char) i, 'b');
@@ -87,7 +86,7 @@ public class TestAstIdentifier {
          *
          * In Java 24, the definition of Java Letter and/or Java Digit has 
changed.
          */
-        Assume.assumeFalse(JreCompat.isJre24Available());
+        Assume.assumeTrue(Runtime.version().feature() < 24);
         for (int i = 0; i < 0xFFFF; i++) {
             if (Character.isJavaIdentifierPart(i)) {
                 testIdentifier('b', (char) i);


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

Reply via email to