You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/06 11:48:58 UTC

[tomcat] branch 9.0.x updated: Add Java 21 source/target support for JSPs (if JDT version supports it)

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 7ea07ebf49 Add Java 21 source/target support for JSPs (if JDT version supports it)
7ea07ebf49 is described below

commit 7ea07ebf49dcf8003c5990c3a1bb8920556a02f9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 6 11:46:53 2023 +0000

    Add Java 21 source/target support for JSPs (if JDT version supports it)
---
 java/org/apache/jasper/compiler/JDTCompiler.java | 11 +++++++++++
 webapps/docs/changelog.xml                       |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java
index 6c6831f5c0..bfff4efe1f 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -331,6 +331,11 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
                 // Java 8.
                 // This is checked against the actual version below.
                 settings.put(CompilerOptions.OPTION_Source, "20");
+            } else if (opt.equals("21")) {
+                // Constant not available in latest ECJ version that runs on
+                // Java 8.
+                // This is checked against the actual version below.
+                settings.put(CompilerOptions.OPTION_Source, "21");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", opt));
                 settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
@@ -413,6 +418,12 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
                 // This is checked against the actual version below.
                 settings.put(CompilerOptions.OPTION_TargetPlatform, "20");
                 settings.put(CompilerOptions.OPTION_Compliance, "20");
+            } else if (opt.equals("21")) {
+                // Constant not available in latest ECJ version that runs on
+                // Java 8.
+                // This is checked against the actual version below.
+                settings.put(CompilerOptions.OPTION_TargetPlatform, "21");
+                settings.put(CompilerOptions.OPTION_Compliance, "21");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.targetVM", opt));
                 settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2fa8432b47..46f3e71b59 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -153,6 +153,13 @@
         is already called from within a privileged block and skipping the
         unnecessary privileged block improves performance. (markt)
       </fix>
+      <add>
+        Add support for specifying Java 21 (with the value <code>21</code>) as
+        the compiler source and/or compiler target for JSP compilation. If used
+        with an Eclipse JDT compiler version that does not support these values,
+        a warning will be logged and the default will used.
+        (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Other">


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