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 2021/06/24 08:11:36 UTC

[tomcat] branch 10.0.x updated: Add support for compiling JSPs for Java 17

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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
     new be39a52  Add support for compiling JSPs for Java 17
be39a52 is described below

commit be39a52922d71b747206a82dd4d4ba2b8fea563f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 24 09:09:42 2021 +0100

    Add support for compiling JSPs for Java 17
---
 java/org/apache/jasper/compiler/JDTCompiler.java | 11 ++++++++---
 webapps/docs/changelog.xml                       |  7 +++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java
index 7e3e4de..10d80e0 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -310,10 +310,12 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
             } else if(opt.equals("15")) {
                 settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
             } else if(opt.equals("16")) {
+                settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_16);
+            } else if(opt.equals("17")) {
                 // Constant not available in latest ECJ version shipped with
                 // Tomcat. May be supported in a snapshot build.
                 // This is checked against the actual version below.
-                settings.put(CompilerOptions.OPTION_Source, "16");
+                settings.put(CompilerOptions.OPTION_Source, "17");
             } else {
                 log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", opt));
                 settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
@@ -370,11 +372,14 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler {
                 settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
                 settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
             } else if(opt.equals("16")) {
+                settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_16);
+                settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_16);
+            } else if(opt.equals("17")) {
                 // Constant not available in latest ECJ version shipped with
                 // Tomcat. May be supported in a snapshot build.
                 // This is checked against the actual version below.
-                settings.put(CompilerOptions.OPTION_TargetPlatform, "16");
-                settings.put(CompilerOptions.OPTION_Compliance, "16");
+                settings.put(CompilerOptions.OPTION_TargetPlatform, "17");
+                settings.put(CompilerOptions.OPTION_Compliance, "17");
             } 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 12b672a..0fbf632 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -200,6 +200,13 @@
       <update>
         Update to the Eclipse JDT compiler 4.20. (markt)
       </update>
+      <add>
+        Add support for specifying Java 17 (with the value <code>17</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 latest supported version will used.
+        (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="WebSocket">

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