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

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

commit dac8def47dd9037e050853462612bac37b095ba8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 10 12:52:51 2024 -0600

    Update Jasper to compile to Java 21 by default
---
 conf/web.xml                                       |  4 ++--
 java/org/apache/jasper/EmbeddedServletOptions.java |  4 ++--
 java/org/apache/jasper/JspC.java                   |  4 ++--
 java/org/apache/jasper/compiler/JDTCompiler.java   | 14 +++++++-------
 webapps/docs/changelog.xml                         |  5 +++++
 webapps/docs/jasper-howto.xml                      |  4 ++--
 6 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/conf/web.xml b/conf/web.xml
index d4037523fc..7d4637ac26 100644
--- a/conf/web.xml
+++ b/conf/web.xml
@@ -160,9 +160,9 @@
   <!--                       pages.  See the jasper documentation for more  -->
   <!--                       information.                                   -->
   <!--                                                                      -->
-  <!--   compilerSourceVM    Compiler source VM. [17]                       -->
+  <!--   compilerSourceVM    Compiler source VM. [21]                       -->
   <!--                                                                      -->
-  <!--   compilerTargetVM    Compiler target VM. [17]                       -->
+  <!--   compilerTargetVM    Compiler target VM. [21]                       -->
   <!--                                                                      -->
   <!--   development         Is Jasper used in development mode? If true,   -->
   <!--                       the frequency at which JSPs are checked for    -->
diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java 
b/java/org/apache/jasper/EmbeddedServletOptions.java
index 5bfd47eb72..6176740b32 100644
--- a/java/org/apache/jasper/EmbeddedServletOptions.java
+++ b/java/org/apache/jasper/EmbeddedServletOptions.java
@@ -124,12 +124,12 @@ public final class EmbeddedServletOptions implements 
Options {
     /**
      * Compiler target VM.
      */
-    private String compilerTargetVM = "17";
+    private String compilerTargetVM = "21";
 
     /**
      * The compiler source VM.
      */
-    private String compilerSourceVM = "17";
+    private String compilerSourceVM = "21";
 
     /**
      * The compiler class name.
diff --git a/java/org/apache/jasper/JspC.java b/java/org/apache/jasper/JspC.java
index 8656617bef..e31918cca5 100644
--- a/java/org/apache/jasper/JspC.java
+++ b/java/org/apache/jasper/JspC.java
@@ -197,8 +197,8 @@ public class JspC extends Task implements Options {
 
     protected String compiler = null;
 
-    protected String compilerTargetVM = "17";
-    protected String compilerSourceVM = "17";
+    protected String compilerTargetVM = "21";
+    protected String compilerSourceVM = "21";
 
     protected boolean classDebugInfo = true;
 
diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java 
b/java/org/apache/jasper/compiler/JDTCompiler.java
index a9e6347665..67fa51bbde 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -332,11 +332,11 @@ public class JDTCompiler extends 
org.apache.jasper.compiler.Compiler {
                 settings.put(CompilerOptions.OPTION_Source, "24");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", 
opt));
-                settings.put(CompilerOptions.OPTION_Source, 
CompilerOptions.VERSION_17);
+                settings.put(CompilerOptions.OPTION_Source, 
CompilerOptions.VERSION_21);
             }
         } else {
-            // Default to 17
-            settings.put(CompilerOptions.OPTION_Source, 
CompilerOptions.VERSION_17);
+            // Default to 21
+            settings.put(CompilerOptions.OPTION_Source, 
CompilerOptions.VERSION_21);
         }
 
         // Target JVM
@@ -420,12 +420,12 @@ public class JDTCompiler extends 
org.apache.jasper.compiler.Compiler {
                 settings.put(CompilerOptions.OPTION_Compliance, "24");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.targetVM", 
opt));
-                settings.put(CompilerOptions.OPTION_TargetPlatform, 
CompilerOptions.VERSION_17);
+                settings.put(CompilerOptions.OPTION_TargetPlatform, 
CompilerOptions.VERSION_21);
             }
         } else {
-            // Default to 17
-            settings.put(CompilerOptions.OPTION_TargetPlatform, 
CompilerOptions.VERSION_17);
-            settings.put(CompilerOptions.OPTION_Compliance, 
CompilerOptions.VERSION_17);
+            // Default to 21
+            settings.put(CompilerOptions.OPTION_TargetPlatform, 
CompilerOptions.VERSION_21);
+            settings.put(CompilerOptions.OPTION_Compliance, 
CompilerOptions.VERSION_21);
         }
 
         final IProblemFactory problemFactory = new 
DefaultProblemFactory(Locale.getDefault());
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3210fba314..56e902bc72 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -183,6 +183,11 @@
         Language to support mergin <code>Map</code>Map and <code>Set</code>Set
         and concatenating <code>List</code>s. (markt)
       </add>
+      <update>
+        The defaults for <code>compilerSourceVM</code> and
+        <code>compilerTargetVM</code> have been updated to 21 to align with 
Java
+        21 being the minimum Java version required for Tomcat 12. (markt)
+      </update>
     </changelog>
   </subsection>
 </section>
diff --git a/webapps/docs/jasper-howto.xml b/webapps/docs/jasper-howto.xml
index e0d35f7911..0ef59ec158 100644
--- a/webapps/docs/jasper-howto.xml
+++ b/webapps/docs/jasper-howto.xml
@@ -106,10 +106,10 @@ set then <code>setenv.[sh|bat]</code> should be used to 
add
 to the <code>CLASSPATH</code> environment variable.</li>
 
 <li><strong>compilerSourceVM</strong> - What JDK version are the source files
-compatible with? (Default value: <code>17</code>)</li>
+compatible with? (Default value: <code>21</code>)</li>
 
 <li><strong>compilerTargetVM</strong> - What JDK version are the generated 
files
-compatible with? (Default value: <code>17</code>)</li>
+compatible with? (Default value: <code>21</code>)</li>
 
 <li><strong>development</strong> - Is Jasper used in development mode? If true,
 the frequency at which JSPs are checked for modification may be specified via


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to