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 2022/09/30 10:18:36 UTC

[tomcat] branch 9.0.x updated: Add support for compiling JSPs using Java 20

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 5e869ba147 Add support for compiling JSPs using Java 20
5e869ba147 is described below

commit 5e869ba1478820f079d75ff4eaf68e3b142aa258
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 30 11:16:05 2022 +0100

    Add support for compiling JSPs using Java 20
---
 java/org/apache/jasper/compiler/JDTCompiler.java | 27 +++++++++++++++++-------
 webapps/docs/changelog.xml                       |  7 ++++++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java
index 5bbae6b5fe..6c6831f5c0 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -317,15 +317,20 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
                 // This is checked against the actual version below.
                 settings.put(CompilerOptions.OPTION_Source, "17");
             } else if (opt.equals("18")) {
-                // Constant not available in latest ECJ version shipped with
-                // Tomcat. May be supported in a snapshot build.
+                // 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, "18");
             } else if (opt.equals("19")) {
-                // Constant not available in latest ECJ version shipped with
-                // Tomcat. May be supported in a snapshot build.
+                // 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, "19");
+            } else if (opt.equals("20")) {
+                // 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, "20");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", opt));
                 settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
@@ -391,17 +396,23 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
                 settings.put(CompilerOptions.OPTION_TargetPlatform, "17");
                 settings.put(CompilerOptions.OPTION_Compliance, "17");
             } else if (opt.equals("18")) {
-                // Constant not available in latest ECJ version shipped with
-                // Tomcat. May be supported in a snapshot build.
+                // 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, "18");
                 settings.put(CompilerOptions.OPTION_Compliance, "18");
             } else if (opt.equals("19")) {
-                // Constant not available in latest ECJ version shipped with
-                // Tomcat. May be supported in a snapshot build.
+                // 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, "19");
                 settings.put(CompilerOptions.OPTION_Compliance, "19");
+            } else if (opt.equals("20")) {
+                // 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, "20");
+                settings.put(CompilerOptions.OPTION_Compliance, "20");
             } 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 aaa0db5c05..b81dd781fd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -119,6 +119,13 @@
         <bug>66277</bug>: Fix regressions in refactoring from <code>Stack</code>
         <code>ArrayDeque</code>.
       </fix>
+      <add>
+        Add support for specifying Java 20 (with the value <code>20</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>
 </section>


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