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

ddekany pushed a commit to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit 6927e56fe444fcd1880fa2ee7ed4ae01ee8dcd7d
Merge: ad1171f0 d6304199
Author: ddekany <[email protected]>
AuthorDate: Fri Dec 8 18:15:21 2023 +0100

    Merge branch '2.3-gae' into FREEMARKER-35
    
    # Conflicts:
    #       build.xml
    #       src/main/java/freemarker/core/_JavaVersions.java
    #       src/test/resources/logback-test.xml

 .asf.yaml                                          |  33 +++++
 .github/workflows/ci.yml                           |  81 ++++++++++++
 .gitignore                                         |   2 +
 .travis.yml                                        |  46 -------
 README.md                                          |  18 +--
 build.xml                                          |  42 +++---
 ivy.xml                                            |   9 +-
 osgi.bnd                                           |   4 +-
 .../java/freemarker/core/_Java16.java}             |  28 ++--
 src/main/java/freemarker/core/_Java16Impl.java     |  57 ++++++++
 src/main/java/freemarker/core/_JavaVersions.java   |  80 ++++++++++++
 .../java/freemarker/ext/beans/BeansWrapper.java    |  11 +-
 .../freemarker/ext/beans/ClassIntrospector.java    |   6 +-
 .../ext/beans/DefaultMemberAccessPolicy.java       |   2 +-
 .../freemarker/ext/beans/MemberAccessPolicy.java   |   4 +
 .../ext/beans/MethodAppearanceFineTuner.java       |   2 +-
 .../freemarker/ext/servlet/FreemarkerServlet.java  |  40 ++++--
 src/manual/en_US/book.xml                          |  46 +++++--
 .../java/freemarker/core/CAndCnBuiltInTest.java    |   2 +-
 src/test/java/freemarker/core/DateFormatTest.java  |   2 +-
 .../java/freemarker/core/NumberFormatTest.java     |   2 +-
 .../ext/jsp/RealServletContainertTest.java         |   4 +-
 .../freemarker/template/MockServletContext.java    | 143 +++++++++++++++++++++
 .../freemarker/test/servlet/WebAppTestCase.java    |  23 +++-
 .../test/templatesuite/expected/number-format.txt  |   4 +-
 .../test/templatesuite/templates/number-format.ftl |   2 +-
 src/test/resources/logback-test.xml                |   2 +
 27 files changed, 562 insertions(+), 133 deletions(-)

diff --cc build.xml
index 90300b50,38c2c6e2..22db00b5
--- a/build.xml
+++ b/build.xml
@@@ -53,8 -58,9 +54,8 @@@
    </condition>
    <available property="atLeastJDK8" classname="java.util.function.Predicate"/>
  
-   <!-- When boot.classpath.j2se* is missing, these will be the defaults: -->
+   <!-- When boot.classpath.j* is missing, these will be the defaults: -->
    <!-- Note: Target "dist" doesn't allow using these. -->
 -  <property name="boot.classpath.j2se1.7" value="${sun.boot.class.path}" />
    <property name="boot.classpath.j2se1.8" value="${sun.boot.class.path}" />
  
    <!-- For checking the correctness of the boot.classpath.j2se* -->
@@@ -238,10 -255,21 +239,12 @@@
        </src>
      </javac>
  
-     <rmic
-       base="build/classes" includes="freemarker/debug/impl/Rmi*Impl.class"
 -    <ivy:cachepath conf="build.base" pathid="ivy.dep" />
 -    <javac srcdir="build/src-main-java-filtered" destdir="build/classes" 
deprecation="off"
 -      debug="on" optimize="off" target="1.8" source="1.8" encoding="utf-8"
 -      includeantruntime="false"
--      classpathref="ivy.dep"
-       verify="yes" stubversion="1.2"
 -      bootclasspath="${boot.classpath.j2se1.8}"
 -      includes="freemarker/core/_Java8Impl.java"
 -    />
 -
+     <ivy:cachepath conf="build.base" pathid="ivy.dep" />
+     <javac srcdir="build/src-main-java-filtered" destdir="build/classes" 
deprecation="off"
+            debug="on" optimize="off" release="16" encoding="utf-8"
+            includeantruntime="false"
+            classpathref="ivy.dep"
+            includes="freemarker/core/_Java16Impl.java"
      />
  
      <ivy:cachepath conf="build.jsp2.0" pathid="ivy.dep.jsp2.0" />
diff --cc src/main/java/freemarker/core/_JavaVersions.java
index 00000000,9023b642..9530e593
mode 000000,100644..100644
--- a/src/main/java/freemarker/core/_JavaVersions.java
+++ b/src/main/java/freemarker/core/_JavaVersions.java
@@@ -1,0 -1,105 +1,80 @@@
+ /*
+  * 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 freemarker.core;
+ 
+ import freemarker.log.Logger;
+ import freemarker.template.Version;
+ import freemarker.template.utility.SecurityUtilities;
+ 
+ /**
+  * Used internally only, might change without notice!
+  */
+ public final class _JavaVersions {
+     
+     private _JavaVersions() {
+         // Not meant to be instantiated
+     }
+ 
 -    private static final boolean IS_AT_LEAST_8 = isAtLeast(8, 
"java.time.Instant");
 -
 -    /**
 -     * {@code null} if Java 8 is not available, otherwise the object through 
with the Java 8 operations are available.
 -     */
 -    static public final _Java8 JAVA_8;
 -    static {
 -        _Java8 java8;
 -        if (IS_AT_LEAST_8) {
 -            try {
 -                java8 = (_Java8) 
Class.forName("freemarker.core._Java8Impl").getField("INSTANCE").get(null);
 -            } catch (Exception e) {
 -                try {
 -                    Logger.getLogger("freemarker.runtime").error("Failed to 
access Java 8 functionality", e);
 -                } catch (Exception e2) {
 -                    // Suppressed
 -                }
 -                java8 = null;
 -            }
 -        } else {
 -            java8 = null;
 -        }
 -        JAVA_8 = java8;
 -    }
 -
+     private static final boolean IS_AT_LEAST_16 = isAtLeast(16, 
"java.net.UnixDomainSocketAddress");
+ 
+     /**
+      * {@code null} if Java 8 is not available, otherwise the object through 
with the Java 8 operations are available.
+      */
+     static public final _Java16 JAVA_16;
+     static {
+         _Java16 java16;
+         if (IS_AT_LEAST_16) {
+             try {
+                 java16 = (_Java16) 
Class.forName("freemarker.core._Java16Impl").getField("INSTANCE").get(null);
+             } catch (Exception e) {
+                 try {
+                     Logger.getLogger("freemarker.runtime").error("Failed to 
access Java 16 functionality", e);
+                 } catch (Exception e2) {
+                     // Suppressed
+                 }
+                 java16 = null;
+             }
+         } else {
+             java16 = null;
+         }
+         JAVA_16 = java16;
+     }
+ 
+     private static boolean isAtLeast(int minimumMinorVersion, String 
proofClassPresence) {
+         boolean result = false;
+         String vStr = SecurityUtilities.getSystemProperty("java.version", 
null);
+         if (vStr != null) {
+             try {
+                 Version v = new Version(vStr);
+                 result = v.getMajor() == 1 && v.getMinor() >= 
minimumMinorVersion || v.getMajor() > 1;
+             } catch (Exception e) {
+                 // Ignore
+             }
+         } else {
+             try {
+                 Class.forName(proofClassPresence);
+                 result = true;
+             } catch (Exception e) {
+                 // Ignore
+             }
+         }
+         return result;
+     }
+ 
+ }
diff --cc src/test/resources/logback-test.xml
index 0aefe851,2ddfb821..cd911fab
--- a/src/test/resources/logback-test.xml
+++ b/src/test/resources/logback-test.xml
@@@ -26,7 -26,8 +26,9 @@@
        </appender>
        
        <logger name="org.eclipse.jetty" level="INFO" />
+       <logger name="org.apache.tomcat" level="INFO" />
+       <logger name="org.apache.jasper" level="INFO" />
 +      <logger name="freemarker.runtime.attempt" level="INFO" />
  
        <root level="debug">
                <appender-ref ref="STDOUT" />

Reply via email to