Skip to content

Commit

Permalink
Add support for compiling JSPs targeting Java 22
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Jun 29, 2023
1 parent 7329c7c commit 440d4b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions java/org/apache/jasper/compiler/JDTCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ public void cleanup() {
// Tomcat. May be supported in a snapshot build.
// This is checked against the actual version below.
settings.put(CompilerOptions.OPTION_Source, "21");
} else if (opt.equals("22")) {
// 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, "22");
} else {
log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", opt));
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
Expand Down Expand Up @@ -400,6 +405,12 @@ public void cleanup() {
// This is checked against the actual version below.
settings.put(CompilerOptions.OPTION_TargetPlatform, "21");
settings.put(CompilerOptions.OPTION_Compliance, "21");
} else if (opt.equals("22")) {
// 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, "22");
settings.put(CompilerOptions.OPTION_Compliance, "22");
} else {
log.warn(Localizer.getMessage("jsp.warning.unknown.targetVM", opt));
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
Expand Down
7 changes: 7 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@
of the Jakarta EL API to align with the latest proposals for the Jakarta
EL 6.0 API. (markt)
</add>
<add>
Add support for specifying Java 22 (with the value <code>22</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="WebSocket">
Expand Down

0 comments on commit 440d4b0

Please sign in to comment.