Skip to content

Commit

Permalink
[UNDERTOW-2530] Adding support for JDK20 , JDK21 and JDK22 in Jastow …
Browse files Browse the repository at this point in the history
…compiler
  • Loading branch information
ropalka committed Nov 27, 2024
1 parent 0ff7ad0 commit 8a9a2f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<version.jakarta.servlet.jsp.jakarta-servlet-jsp-api>3.1.1</version.jakarta.servlet.jsp.jakarta-servlet-jsp-api>
<version.junit>4.13.2</version.junit>
<version.org.apache.httpcomponents>4.5.14</version.org.apache.httpcomponents>
<version.org.eclipse.jdt.ecj>3.32.0</version.org.eclipse.jdt.ecj>
<version.org.eclipse.jdt.ecj>3.39.0</version.org.eclipse.jdt.ecj>
<version.org.glassfish.expressly>5.0.0</version.org.glassfish.expressly>
<version.org.jboss.logging.jboss-logging>3.6.1.Final</version.org.jboss.logging.jboss-logging>
<version.org.jboss.logging.jboss-logging-tools>3.0.3.Final</version.org.jboss.logging.jboss-logging-tools>
Expand Down
33 changes: 24 additions & 9 deletions src/main/java/org/apache/jasper/compiler/JDTCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public void cleanup() {
}

// Source JVM
if(ctxt.getOptions().getCompilerSourceVM() != null) {
if (ctxt.getOptions().getCompilerSourceVM() != null) {
String opt = ctxt.getOptions().getCompilerSourceVM();
if(opt.equals("1.1")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_1);
Expand Down Expand Up @@ -332,17 +332,23 @@ public void cleanup() {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_18);
} else if (opt.equals("19")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_19);
} else if (opt.equals("20")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_20);
} else if (opt.equals("21")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_21);
} else if (opt.equals("22")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_22);
} else {
JasperLogger.COMPILER_LOGGER.unknownSourceJvm(opt);
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_17);
}
} else {
// Default to 11
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
// Default to 17
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_17);
}

// Target JVM
if(ctxt.getOptions().getCompilerTargetVM() != null) {
if (ctxt.getOptions().getCompilerTargetVM() != null) {
String opt = ctxt.getOptions().getCompilerTargetVM();
if(opt.equals("1.1")) {
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
Expand Down Expand Up @@ -397,14 +403,23 @@ public void cleanup() {
} else if (opt.equals("19")) {
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_19);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_19);
} else if (opt.equals("20")) {
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_20);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_20);
} else if (opt.equals("21")) {
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_21);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_21);
} else if (opt.equals("22")) {
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_22);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_22);
} else {
JasperLogger.COMPILER_LOGGER.unknownTargetJvm(opt);
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_17);
}
} else {
// Default to 11
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_11);
// Default to 17
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_17);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_17);
}

final IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
Expand Down

0 comments on commit 8a9a2f1

Please sign in to comment.