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

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


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

commit da831f673dc24b5c53f261b0ee8cea0b5662a772
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 4c26bd06c5..671d324fe9 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -379,6 +379,11 @@ public class JDTCompiler extends 
org.apache.jasper.compiler.Compiler {
                 // Java 7.
                 // 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 7.
+                // 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_7);
@@ -482,6 +487,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 7.
+                // 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_7);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d940ab992e..c1d0918dbb 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -164,6 +164,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="Web applications">


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

Reply via email to