diff --git a/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml b/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml
index 5989419df453..4df031705e85 100644
--- a/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml
+++ b/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml
@@ -2444,7 +2444,7 @@
org.eclipse.jdt
ecj
- 3.35.0
+ 3.36.0
org.eclipse.jetty.websocket
diff --git a/dev/cnf/oss_dependencies.maven b/dev/cnf/oss_dependencies.maven
index e8b2de8d54aa..32dc0500305a 100644
--- a/dev/cnf/oss_dependencies.maven
+++ b/dev/cnf/oss_dependencies.maven
@@ -484,7 +484,7 @@ org.eclipse.birt.runtime.3_7_1:org.apache.xml.serializer:2.7.1
org.eclipse.birt.runtime:org.w3c.css.sac:1.3.1.v200903091627
org.eclipse.jdt:ecj:3.26.0
org.eclipse.jdt:ecj:3.33.0
-org.eclipse.jdt:ecj:3.35.0
+org.eclipse.jdt:ecj:3.36.0
org.eclipse.jetty.websocket:javax-websocket-client-impl:9.2.2.v20140723
org.eclipse.jetty.websocket:javax-websocket-client-impl:9.4.39.v20210325
org.eclipse.jetty.websocket:websocket-api:9.2.2.v20140723
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/bnd.bnd b/dev/com.ibm.ws.jsp.2.3_fat/bnd.bnd
index 32319cf15e35..1601cf83cc9b 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/bnd.bnd
+++ b/dev/com.ibm.ws.jsp.2.3_fat/bnd.bnd
@@ -6,9 +6,6 @@
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
#*******************************************************************************
-include= ~../cnf/resources/bnd/bundle.props
bVersion=1.0
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/build.gradle b/dev/com.ibm.ws.jsp.2.3_fat/build.gradle
index 02217c9ba72d..46569dce71d4 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/build.gradle
+++ b/dev/com.ibm.ws.jsp.2.3_fat/build.gradle
@@ -6,9 +6,6 @@
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
dependencies {
requiredLibs project(':io.openliberty.org.apache.commons.codec'),
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/FATSuite.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/FATSuite.java
index 61c7f4ad9faf..af85d2f26680 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/FATSuite.java
+++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/FATSuite.java
@@ -19,6 +19,9 @@
import com.ibm.ws.jsp23.fat.tests.JSP23JSP22ServerTest;
import com.ibm.ws.jsp23.fat.tests.JSPCdiTest;
import com.ibm.ws.jsp23.fat.tests.JSPExceptionTests;
+import com.ibm.ws.jsp23.fat.tests.JSPJava11Test;
+import com.ibm.ws.jsp23.fat.tests.JSPJava17Test;
+import com.ibm.ws.jsp23.fat.tests.JSPJava21Test;
import com.ibm.ws.jsp23.fat.tests.JSPJava8Test;
import com.ibm.ws.jsp23.fat.tests.JSPPrepareJSPThreadCountDefaultValueTests;
import com.ibm.ws.jsp23.fat.tests.JSPPrepareJSPThreadCountNonDefaultValueTests;
@@ -42,6 +45,9 @@
JSPExceptionTests.class,
JSPSkipMetaInfTests.class,
JSPJava8Test.class,
+ JSPJava11Test.class,
+ JSPJava17Test.class,
+ JSPJava21Test.class,
JSPCdiTest.class,
JSP23JSP22ServerTest.class,
JSPPrepareJSPThreadCountNonDefaultValueTests.class,
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java
new file mode 100644
index 000000000000..eded92876326
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2023 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package com.ibm.ws.jsp23.fat.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.logging.Logger;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.ibm.websphere.simplicity.ShrinkHelper;
+import com.ibm.websphere.simplicity.config.ServerConfiguration;
+import com.ibm.ws.jsp23.fat.JSPUtils;
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import componenttest.annotation.MinimumJavaLevel;
+import componenttest.annotation.Server;
+import componenttest.annotation.SkipForRepeat;
+import componenttest.custom.junit.runner.FATRunner;
+import componenttest.custom.junit.runner.Mode;
+import componenttest.custom.junit.runner.Mode.TestMode;
+import componenttest.topology.impl.LibertyServer;
+
+/**
+ * JSP 2.3 tests which use Java 11 specific features.
+ *
+ * Tests must only run when Java 11 is in use.
+ *
+ */
+@Mode(TestMode.FULL)
+@MinimumJavaLevel(javaLevel = 11)
+@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all.
+@RunWith(FATRunner.class)
+public class JSPJava11Test {
+ private static final String APP_NAME = "TestJSPWithJava11";
+ private static final Logger LOG = Logger.getLogger(JSPJava11Test.class.getName());
+
+ @Server("jspJava11Server")
+ public static LibertyServer server;
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ ShrinkHelper.defaultDropinApp(server, APP_NAME + ".war");
+
+ server.startServer(JSPJava11Test.class.getSimpleName() + ".log");
+ }
+
+ @AfterClass
+ public static void testCleanup() throws Exception {
+ // Stop the server
+ if (server != null && server.isStarted()) {
+ server.stopServer();
+ }
+ }
+
+ /**
+ * Simple test for index.jsp. Page uses Java 11's String#strip method
+ *
+ * @throws Exception
+ * if something goes horribly wrong
+ */
+ @Test
+ public void testJava11JSP() throws Exception {
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("Java 11's String strip() method failed", response.getText().contains("success-strip"));
+ assertTrue("Java 11's String lines() did not return a stream.", response.getText().contains("java.util.stream.ReferencePipeline"));
+ assertTrue("Java 11's Map copyOf method failed", response.getText().contains("{key=success-copyof}"));
+ }
+
+ /**
+ * Same test as testJava11JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ))
+ *
+ * https://openliberty.io/docs/latest/reference/config/jspEngine.html
+ *
+ * @throws Exception if something goes horribly wrong
+ *
+ */
+ @Test
+ public void testJava11viaUseJDKCompiler() throws Exception {
+
+ ServerConfiguration configuration = server.getServerConfiguration();
+ configuration.getJspEngine().setUseJDKCompiler(true);
+ LOG.info("New server configuration used: " + configuration);
+ server.setMarkToEndOfLog();
+ server.updateServerConfiguration(configuration);
+ server.restartApplication(APP_NAME);
+ server.waitForConfigUpdateInLogUsingMark(Collections.singleton(APP_NAME), false, "CWWKT0016I:.*TestJSPWithJava11.*");
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("Java 11's String strip() method failed", response.getText().contains("success-strip"));
+ assertTrue("Java 11's String lines() did not return a stream.", response.getText().contains("java.util.stream.ReferencePipeline"));
+ assertTrue("Java 11's Map copyOf method failed", response.getText().contains("{key=success-copyof}"));
+ }
+}
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java
new file mode 100644
index 000000000000..d576b54aed54
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2023, 2024 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package com.ibm.ws.jsp23.fat.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.logging.Logger;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.ibm.websphere.simplicity.ShrinkHelper;
+import com.ibm.ws.jsp23.fat.JSPUtils;
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import componenttest.annotation.MinimumJavaLevel;
+import componenttest.annotation.MaximumJavaLevel;
+import componenttest.annotation.Server;
+import componenttest.annotation.SkipForRepeat;
+import componenttest.custom.junit.runner.FATRunner;
+import componenttest.topology.impl.LibertyServer;
+
+import com.ibm.websphere.simplicity.config.ServerConfiguration;
+/**
+ * JSP 2.3 tests which use Java 17 specific features.
+ *
+ * Tests must only run when Java 17 or later is in use.
+ *
+ */
+@MinimumJavaLevel(javaLevel = 17)
+@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all.
+@RunWith(FATRunner.class)
+public class JSPJava17Test {
+ private static final String APP_NAME = "TestJSPWithJava17";
+ private static final Logger LOG = Logger.getLogger(JSPJava17Test.class.getName());
+
+ @Server("jspJava17Server")
+ public static LibertyServer server;
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ ShrinkHelper.defaultDropinApp(server, APP_NAME + ".war");
+
+ server.startServer(JSPJava17Test.class.getSimpleName() + ".log");
+ }
+
+ @AfterClass
+ public static void testCleanup() throws Exception {
+ // Stop the server
+ if (server != null && server.isStarted()) {
+ // testBothjdkSourceLevelAndjavaSourceLevel causes CWWJS0005W: Both javaSourceLevel=17 and jdkSourceLevel=18 are specified. Defaulting to javaSourceLevel=17
+ server.stopServer("CWWJS0005W");
+ }
+ }
+
+ /**
+ * Simple test for index.jsp. Page uses Java 17's instanceof pattern matching
+ *
+ * @throws Exception
+ * if something goes horribly wrong
+ */
+ @Test
+ public void testJava17JSP() throws Exception {
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: success", response.getText().contains("success-text-block"));
+ assertTrue("The response did not contain: success", response.getText().contains("success-pattern-matching"));
+ }
+
+ /**
+ * Same test as testJava17JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ))
+ *
+ * https://openliberty.io/docs/latest/reference/config/jspEngine.html
+ *
+ * @throws Exception if something goes horribly wrong
+ *
+ */
+ @Test
+ public void testJava17viaUseJDKCompiler() throws Exception {
+
+ ServerConfiguration configuration = server.getServerConfiguration();
+ configuration.getJspEngine().setUseJDKCompiler(true);
+ LOG.info("New server configuration used: " + configuration);
+
+ server.setMarkToEndOfLog();
+ server.updateServerConfiguration(configuration);
+ server.restartApplication(APP_NAME);
+ server.waitForConfigUpdateInLogUsingMark(Collections.singleton(APP_NAME), false, "CWWKT0016I:.*TestJSPWithJava17.*");
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: success", response.getText().contains("success-text-block"));
+ assertTrue("The response did not contain: success", response.getText().contains("success-pattern-matching"));
+ }
+
+ /*
+ * Verifies that javaSourceLevel overrides jdkSourceLevel if both are set. Warning is also logged
+ */
+ @Test
+ public void testBothjdkSourceLevelAndjavaSourceLevel() throws Exception {
+
+ ServerConfiguration configuration = server.getServerConfiguration();
+ configuration.getJspEngine().setJdkSourceLevel("18");
+ LOG.info("New server configuration used: " + configuration);
+
+ server.setMarkToEndOfLog();
+ server.updateServerConfiguration(configuration);
+ server.restartApplication(APP_NAME);
+ server.waitForConfigUpdateInLogUsingMark(Collections.singleton(APP_NAME), false, "CWWKT0016I:.*TestJSPWithJava17.*");
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: success", response.getText().contains("success-text-block"));
+ assertTrue("The response did not contain: success", response.getText().contains("success-pattern-matching"));
+ }
+}
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java
new file mode 100644
index 000000000000..277702840dfb
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2023 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package com.ibm.ws.jsp23.fat.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.logging.Logger;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.ibm.websphere.simplicity.ShrinkHelper;
+import com.ibm.ws.jsp23.fat.JSPUtils;
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import componenttest.annotation.MinimumJavaLevel;
+import componenttest.annotation.MaximumJavaLevel;
+import componenttest.annotation.Server;
+import componenttest.annotation.SkipForRepeat;
+import componenttest.custom.junit.runner.FATRunner;
+import componenttest.custom.junit.runner.Mode;
+import componenttest.custom.junit.runner.Mode.TestMode;
+import componenttest.topology.impl.LibertyServer;
+
+import com.ibm.websphere.simplicity.config.ServerConfiguration;
+/**
+ * JSP 2.3 tests which use Java 21 specific features.
+ *
+ * Tests must only run when Java 21 or later is in use.
+ *
+ */
+@Mode(TestMode.FULL)
+@MinimumJavaLevel(javaLevel = 21)
+@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all.
+@RunWith(FATRunner.class)
+public class JSPJava21Test {
+ private static final String APP_NAME = "TestJSPWithJava21";
+ private static final Logger LOG = Logger.getLogger(JSPJava21Test.class.getName());
+
+ @Server("jspJava21Server")
+ public static LibertyServer server;
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ ShrinkHelper.defaultDropinApp(server, APP_NAME + ".war");
+
+ server.startServer(JSPJava21Test.class.getSimpleName() + ".log");
+ }
+
+ @AfterClass
+ public static void testCleanup() throws Exception {
+ // Stop the server
+ if (server != null && server.isStarted()) {
+ server.stopServer();
+ }
+ }
+
+ /**
+ * Simple test for index.jsp. Page uses Java 21's instanceof pattern matching
+ *
+ * @throws Exception
+ * if something goes horribly wrong
+ */
+ @Test
+ public void testJava21JSP() throws Exception {
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: success", response.getText().contains("getFirst success!"));
+ assertTrue("The response did not contain: success", response.getText().contains("switch success!"));
+ }
+
+ /**
+ * Same test as testJava21JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ))
+ *
+ * https://openliberty.io/docs/latest/reference/config/jspEngine.html
+ *
+ * @throws Exception if something goes horribly wrong
+ *
+ */
+ @Test
+ public void testJava21viaUseJDKCompiler() throws Exception {
+
+ ServerConfiguration configuration = server.getServerConfiguration();
+ configuration.getJspEngine().setUseJDKCompiler(true);
+ LOG.info("New server configuration used: " + configuration);
+
+ server.setMarkToEndOfLog();
+ server.updateServerConfiguration(configuration);
+ server.restartApplication(APP_NAME);
+ server.waitForConfigUpdateInLogUsingMark(Collections.singleton(APP_NAME), false, "CWWKT0016I:.*TestJSPWithJava21.*");
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: success", response.getText().contains("getFirst success!"));
+ assertTrue("The response did not contain: success", response.getText().contains("switch success!"));
+ }
+}
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java
index 8d8effad2be8..edce9f057aa7 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java
+++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java
@@ -6,15 +6,13 @@
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp23.fat.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.Collections;
import java.util.logging.Logger;
import org.junit.AfterClass;
@@ -34,10 +32,11 @@
import componenttest.custom.junit.runner.FATRunner;
import componenttest.topology.impl.LibertyServer;
+import com.ibm.websphere.simplicity.config.ServerConfiguration;
/**
* JSP 2.3 tests which use Java 1.8 specific features.
*
- * Tests must only run when Java 1.8 is in use.
+ * Tests must only run when Java 1.8 or later is in use.
*
* Tests that just need to drive a simple request using our WebBrowser object can be placed in this class.
*
@@ -71,7 +70,7 @@ public static void testCleanup() throws Exception {
* Simple test for Index.jsp
*
* @throws Exception
- * if something goes horribly wrong
+ * if something goes horribly wrong
*/
@Test
public void testJava8JSP() throws Exception {
@@ -89,4 +88,39 @@ public void testJava8JSP() throws Exception {
200, response.getResponseCode());
assertTrue("The response did not contain: onetwothreefour", response.getText().contains("onetwothreefour"));
}
+
+ /**
+ * Same test as testJava8JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ))
+ *
+ * https://openliberty.io/docs/latest/reference/config/jspEngine.html
+ *
+ * @throws Exception if something goes horribly wrong
+ *
+ */
+ @Test
+ public void testJava8viaUseJDKCompiler() throws Exception {
+
+ ServerConfiguration configuration = server.getServerConfiguration();
+ configuration.getJspEngine().setUseJDKCompiler(true);
+ LOG.info("New server configuration used: " + configuration);
+
+ server.setMarkToEndOfLog();
+ server.updateServerConfiguration(configuration);
+ server.restartApplication(APP_NAME);
+ server.waitForConfigUpdateInLogUsingMark(Collections.singleton(APP_NAME), false, "CWWKT0016I:.*TestJSPWithJava8.*");
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus(false);
+
+ String url = JSPUtils.createHttpUrlString(server, APP_NAME, "index.jsp");
+ LOG.info("url: " + url);
+
+ WebRequest request = new GetMethodWebRequest(url);
+ WebResponse response = wc.getResponse(request);
+ LOG.info("Servlet response : " + response.getText());
+
+ assertEquals("Expected " + 200 + " status code was not returned!",
+ 200, response.getResponseCode());
+ assertTrue("The response did not contain: onetwothreefour", response.getText().contains("onetwothreefour"));
+ }
}
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/.gitignore b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/.gitignore
new file mode 100644
index 000000000000..f3f483d82c07
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/.gitignore
@@ -0,0 +1 @@
+/dropins
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties
new file mode 100644
index 000000000000..60261fb0a132
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2023 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+bootstrap.include=../testports.properties
+osgi.console=7777
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml
new file mode 100644
index 000000000000..9b51fb777a74
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ jsp-2.3
+ localConnector-1.0
+
+
+
+
+
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/.gitignore b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/.gitignore
new file mode 100644
index 000000000000..f3f483d82c07
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/.gitignore
@@ -0,0 +1 @@
+/dropins
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties
new file mode 100644
index 000000000000..60261fb0a132
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2023 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+bootstrap.include=../testports.properties
+osgi.console=7777
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml
new file mode 100644
index 000000000000..3d46d454d553
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ jsp-2.3
+ localConnector-1.0
+
+
+
+
+
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/.gitignore b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/.gitignore
new file mode 100644
index 000000000000..f3f483d82c07
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/.gitignore
@@ -0,0 +1 @@
+/dropins
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties
new file mode 100644
index 000000000000..60261fb0a132
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2023 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+bootstrap.include=../testports.properties
+osgi.console=7777
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml
new file mode 100644
index 000000000000..97b8034b4d1e
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ jsp-2.3
+ localConnector-1.0
+
+
+
+
+
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/bootstrap.properties
index 61f538a150a1..c0ee80dacbfc 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/bootstrap.properties
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/bootstrap.properties
@@ -6,9 +6,6 @@
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
###############################################################################
bootstrap.include=../testports.properties
osgi.console=7777
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml
index ef2192b8cf33..aee1afa843dc 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml
+++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml
@@ -1,14 +1,11 @@
@@ -16,10 +13,12 @@
jsp-2.3
+ localConnector-1.0
+
-
-
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml
new file mode 100644
index 000000000000..2fc1b54f8a2e
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ TestJSPWithJava11
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/index.jsp b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/index.jsp
new file mode 100644
index 000000000000..5c58680f3400
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/index.jsp
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ Test Java 11 Compilation
+
+
+
+ Testing Java 11's String.strip function:
+ <% out.print(" success-strip ".strip()); %>
+
+
+ Testing Java 11's String.lines function:
+ <% out.println(" Hello World\n Good Bye\n success-lines".lines()); %>
+
+
+ Java 10's Map.copyOf static method
+ <%
+ java.util.Map map = new java.util.HashMap();
+ map.put("key","success-copyof");
+ out.println(java.util.Map.copyOf(map)); // {key=value}
+ %>
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/WEB-INF/web.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/WEB-INF/web.xml
new file mode 100644
index 000000000000..6c0fe3ace877
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/WEB-INF/web.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ TestJSPWithJava17
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/index.jsp b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/index.jsp
new file mode 100644
index 000000000000..8839c220f05d
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/resources/index.jsp
@@ -0,0 +1,36 @@
+
+
+
+
+
+ Java 17
+
+
+
+
+
+ <%
+ String block = """
+ If this compiles, then the
+ test passes. " success-text-block" woo!
+ """;
+ out.print(block);
+ %>
+
+
+ <%
+ Object o = " success-pattern-matching ";
+ if (o instanceof String s) {
+ out.print(s.strip()); // no need to cast to String
+ }
+ %>
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/WEB-INF/web.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/WEB-INF/web.xml
new file mode 100644
index 000000000000..2b38942e9782
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/WEB-INF/web.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ TestJSPWithJava21
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp
new file mode 100644
index 000000000000..368ca24bfeb4
--- /dev/null
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp
@@ -0,0 +1,36 @@
+
+
+
+
+
+ Java 21
+
+
+
+
+
+ <%
+ java.util.ArrayList list = new java.util.ArrayList();
+ list.add("getFirst success!");
+ out.println(list.getFirst());
+ %>
+
+
+ <%
+ Object test = "hello";
+ switch(test){
+ case Integer i -> out.println("switch fail!");
+ case String s -> out.println("switch success!");
+ default -> out.println("switch fail!");
+ }
+ %>
+
+
diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/resources/WEB-INF/web.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/resources/WEB-INF/web.xml
index 892a9c127a88..ae36211ec0d6 100644
--- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/resources/WEB-INF/web.xml
+++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/resources/WEB-INF/web.xml
@@ -7,9 +7,6 @@
http://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
-
- Contributors:
- IBM Corporation - initial API and implementation
-->
<%@page import="java.io.PrintWriter"%>
<%@page import="java.io.Writer"%>
diff --git a/dev/com.ibm.ws.jsp/resources/OSGI-INF/l10n/metatype.properties b/dev/com.ibm.ws.jsp/resources/OSGI-INF/l10n/metatype.properties
index f9c2bb3adc9c..d4a9f78c6b79 100644
--- a/dev/com.ibm.ws.jsp/resources/OSGI-INF/l10n/metatype.properties
+++ b/dev/com.ibm.ws.jsp/resources/OSGI-INF/l10n/metatype.properties
@@ -1,14 +1,11 @@
###############################################################################
-# Copyright (c) 2011, 2021 IBM Corporation and others.
+# Copyright (c) 2011, 2023 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
###############################################################################
#
#CMVCPATHNAME com.ibm.ws.jpa-2.2/resources/OSGI-INF/l10n/metatype.properties
@@ -25,8 +22,8 @@ disableJspRuntimeCompilation=Disable compilation of JSPs at runtime.
extendedDocumentRoot.name=Extended document root
extendedDocumentRoot=Directory that the JSP engine will search for additional JSP files to serve.
-jdkSourceLevel.name=JDK source level
-jdkSourceLevel=Default Java source level for JSPs compiled by the JSP engine.
+javaSourceLevel.name=Java source level
+javaSourceLevel=Specifies the default Java source level for JSPs that are compiled by the JSP engine. Accepts one of the following LTS releases as a value: 8, 11, 17, and 21.
keepGenerated.name=Keep generated Java source
keepGenerated=Keep Java source files generated for JSPs.
diff --git a/dev/com.ibm.ws.jsp/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.jsp/resources/OSGI-INF/metatype/metatype.xml
index 631c718af72e..3006fe6637a8 100644
--- a/dev/com.ibm.ws.jsp/resources/OSGI-INF/metatype/metatype.xml
+++ b/dev/com.ibm.ws.jsp/resources/OSGI-INF/metatype/metatype.xml
@@ -17,7 +17,15 @@
id="disableJspRuntimeCompilation" required="false" type="Boolean" default="false"/>
-
+
+
+
+
+
+
+
diff --git a/dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops b/dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops
index 1d650fb476d0..a9958fe0a0d6 100644
--- a/dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops
+++ b/dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops
@@ -6,9 +6,6 @@
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
###############################################################################
#CMVCPATHNAME ws/code/jsp/src/com/ibm/ws/jsp/resources/messages.nlsprops
#COMPONENTPREFIX JSPG CWWJS
@@ -1273,7 +1270,6 @@ jsp.isthreadsafe.warning=CWWJS0003W: The Pages 3.1 specification strongly advise
jsp.isthreadsafe.warning.explanation=SingleThreadModel was removed from Servlet 6.0. Pages 3.1 deprecated isThreadSafe with plans to remove it in a future Pages update.
jsp.isthreadsafe.warning.useraction=Remove the isThreadSafe directive from all pages.
-
jsp.useinmemory.warning=CWWJS0004W: The 'useInMemory' JSP Option is not supported. The JSPs will be compiled and saved on disk instead.
jsp.useinmemory.warning.explanation=This feature was never ported from Traditional WebSphere for historical reasons.
jsp.useinmemory.warning.useraction=Remove the useInMemory option from the server.xml, ibm-web-bnd.xml, or the ibm-web-ext.xmi files.
@@ -1281,3 +1277,15 @@ jsp.useinmemory.warning.useraction=Remove the useInMemory option from the server
pages.removed.element.error=CWWJS0005E: The {0} element was removed in Pages 4.0 and therefore is no longer supported.
pages.removed.element.error.explanation=The jsp plugin and related actions were deprecated in Pages 3.1 and removed in 4.0.
pages.removed.element.error.useraction= Remove the jsp plugin, fallback, and params elements from your web app.
+
+jsp.javasourcelevel.warning=CWWJS0006W: The specified javaSourceLevel={0} value exceeds the {1} installed Java level. Therefore, the default Java level is set to {1}.
+jsp.javasourcelevel.warning.explanation=File cannot be compiled with a higher source than the available JDK level.
+jsp.javasourcelevel.warning.useraction=Specify a javaSourceLevel value that is less than or equal to the available JDK level.
+
+jsp.bothsourcelevelset.warning=CWWJS0007W: Both javaSourceLevel={0} and jdkSourceLevel={1} are specified. Defaulting to javaSourceLevel={0}
+jsp.bothsourcelevelset.warning.explanation= Only one source level attribute can be used at a time.
+jsp.bothsourcelevelset.warning.useraction= Specify only the javaSourceLevel attribute. The jdkSourceLevel attribute is stabilized.
+
+jsp.javasourcelevel.value=CWWJS0008I: The value of the JSP attribute javaSourceLevel is \"{0}\".
+jsp.javasourcelevel.value.explanation =
+jsp.javasourcelevel.value.useraction =
diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/JspOptions.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/JspOptions.java
index db542ed9aa7e..bc43606edfad 100644
--- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/JspOptions.java
+++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/JspOptions.java
@@ -6,9 +6,6 @@
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp;
@@ -54,7 +51,8 @@ public class JspOptions {
protected String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
protected boolean isZOS = false;
protected String javaEncoding = "UTF-8";
- private int jdkSourceLevel;
+ private int jdkSourceLevel = -1;
+ private int javaSourceLevel = -1;
protected String jspCompileClasspath = null;
protected boolean keepGenerated = false;
protected boolean keepGeneratedclassfiles = true;
@@ -117,15 +115,15 @@ public class JspOptions {
String overriddenJspOptions = new String();
public JspOptions() {
- setJdkSourceLevel(16);
+ setJavaSourceLevel(8); // Changed in PR 25494
}
public JspOptions(Properties jspParams) {
- setJdkSourceLevel(16);
+ setJavaSourceLevel(8); // Changed in PR 25494
populateOptions(jspParams);
}
- public void populateOptions(Properties jspParams) {
+ public void populateOptions(Properties jspParams) {
/*--------------------*/
/* Load Option Values */
@@ -221,7 +219,9 @@ else if (useJikesCompiler.equalsIgnoreCase("false"))
}
int useJdkSourceLevel = -1;
+ int useJavaSourceLevel = -1;
String rawJdkSourceLevel = jspParams.getProperty("jdkSourceLevel");
+ String rawJavaSourceLevel = jspParams.getProperty("javaSourceLevel");
try {
if (rawJdkSourceLevel != null)
useJdkSourceLevel = Integer.parseInt(rawJdkSourceLevel);
@@ -230,9 +230,29 @@ else if (useJikesCompiler.equalsIgnoreCase("false"))
logger.logp(Level.INFO, CLASS_NAME, "populateOptions", "Invalid value for jdkSourceLevel = " + rawJdkSourceLevel + ".");
}
}
- if (useJdkSourceLevel >= 13) {
- logger.logp(Level.INFO, CLASS_NAME, "populateOptions", JspMessages.getMessage("jsp.jdksourcelevel.value", new Object[] { useJdkSourceLevel })); //152472
+
+ if (rawJavaSourceLevel != null && (rawJavaSourceLevel.equals("8") || rawJavaSourceLevel.equals("1.8"))) // only for Java 8 do we accept 1.8 and 8
+ rawJavaSourceLevel = org.eclipse.jdt.internal.compiler.impl.CompilerOptions.VERSION_1_8;
+ try {
+ if (rawJavaSourceLevel != null)
+ useJavaSourceLevel = Integer.parseInt(rawJavaSourceLevel);
+ } catch(NumberFormatException e) {
+ if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.INFO)) {
+ logger.logp(Level.INFO, CLASS_NAME, "populateOptions", "Invalid value for javaSourceLevel = " + rawJavaSourceLevel + ".");
+ }
+ }
+
+ if(useJavaSourceLevel != -1 && useJdkSourceLevel != -1) {
+ logger.logp(Level.WARNING, CLASS_NAME, "populateOptions", JspMessages.getMessage("jsp.bothsourcelevelset.warning", new Object[] { useJavaSourceLevel, useJdkSourceLevel }));
+ useJdkSourceLevel = -1;
+ }
+
+ if(useJavaSourceLevel != -1) {
+ setJavaSourceLevel(useJavaSourceLevel); //validation already done via metatype.xml options
+ logger.logp(Level.INFO, CLASS_NAME, "populateOptions", JspMessages.getMessage("jsp.javasourcelevel.value", new Object[] { javaSourceLevel }));
+ } else if (useJdkSourceLevel >= 13) {
setJdkSourceLevel(useJdkSourceLevel);
+ logger.logp(Level.INFO, CLASS_NAME, "populateOptions", JspMessages.getMessage("jsp.jdksourcelevel.value", new Object[] { useJdkSourceLevel })); //152472
}
// Normalize compileWithAssert and jdkSourceLevel; compileWithAssert with value true means compile with
@@ -1062,9 +1082,23 @@ public void setJdkSourceLevel(int jdkSourceLevel) {
this.jdkSourceLevel = jdkSourceLevel;
}
+ public void setJavaSourceLevel(int javaSourceLevel) {
+ int jmv = JavaInfo.majorVersion();
+ if (javaSourceLevel > jmv) {
+ // can not specify higher than running Java
+ logger.logp(Level.WARNING, CLASS_NAME, "setJavaSourceLevel", JspMessages.getMessage("jsp.javasourcelevel.warning", new Object[] { javaSourceLevel, jmv }));
+ javaSourceLevel = jmv;
+ }
+ this.javaSourceLevel = javaSourceLevel;
+ }
+
public int getJdkSourceLevel() {
return jdkSourceLevel;
}
+
+ public int getJavaSourceLevel() {
+ return javaSourceLevel;
+ }
public void setVerbose(boolean verbose) {
this.verbose = verbose;
@@ -1601,6 +1635,7 @@ public String toString() { //overrride Object's toString to assist in debugging.
"ieClassId = [" + ieClassId +"]"+separatorString+
"isZOS = [" + isZOS +"]"+separatorString+
"javaEncoding = [" + javaEncoding +"]"+separatorString+
+ "javaSourceLevel = [" + javaSourceLevel +"]"+separatorString+
"jdkSourceLevel = [" + jdkSourceLevel +"]"+separatorString+
"jspCompileClasspath = [" + tmpJspCompileClasspath +"]"+separatorString+
"keepGenerated = [" + keepGenerated +"]"+separatorString+
diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java
index 6c5d9c6d5b92..830870ae9143 100644
--- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java
+++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 1997, 2021 IBM Corporation and others.
+ * Copyright (c) 1997, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp.translator.compiler;
@@ -71,18 +68,20 @@ public class JDTCompiler implements JspCompiler {
private boolean isVerbose = false;
private boolean isDeprecation = false;
private int jdkSourceLevel;
+ private Integer javaSourceLevel;
private boolean useFullPackageNames = false;
public JDTCompiler(ClassLoader loader, JspOptions options) {
this.loader = loader;
javaEncoding = options.getJavaEncoding();
outputDir = options.getOutputDir().getPath();
- isClassDebugInfo = options.isClassDebugInfo();
- isDebugEnabled = options.isDebugEnabled();
- isVerbose = options.isVerbose();
- isDeprecation = options.isDeprecation();
- jdkSourceLevel = options.getJdkSourceLevel();
- useFullPackageNames = options.isUseFullPackageNames();
+ isClassDebugInfo = options.isClassDebugInfo();
+ isDebugEnabled = options.isDebugEnabled();
+ isVerbose = options.isVerbose();
+ isDeprecation = options.isDeprecation();
+ jdkSourceLevel = options.getJdkSourceLevel();
+ javaSourceLevel = options.getJavaSourceLevel();
+ useFullPackageNames = options.isUseFullPackageNames();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "JDTCompiler", "Entering JDTCompiler.");
}
@@ -108,12 +107,16 @@ public JspCompilerResult compile(JspResources[] jspResources, JspResources[] dep
compilerOptionsMap.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
compilerOptionsMap.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
compilerOptionsMap.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
- compilerOptionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
+ compilerOptionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
}
compilerOptionsMap.put(CompilerOptions.OPTION_Encoding, javaEncoding);
- //487396.1 jdkSourceLevel is 15 by default now ... should get into if statement
- if (jdkSourceLevel == 14) {
+ if (javaSourceLevel != -1) {
+ compilerOptionsMap.put(CompilerOptions.OPTION_Source, javaSourceLevel.toString());
+ compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, javaSourceLevel.toString());
+ compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, javaSourceLevel.toString());
+ }
+ else if (jdkSourceLevel == 14) {
compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); //PM32704
compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); //PM32704
@@ -132,13 +135,13 @@ else if (jdkSourceLevel == 16) {
//PM04610 end
else if (jdkSourceLevel == 17) {
compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
- compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7);
+ compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7);
compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7);
}
//126902 start
else if (jdkSourceLevel == 18) {
compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
- compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
+ compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
}
//126902 end
diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java
index 1a600e55b23f..79ea25a67463 100644
--- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java
+++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 1997, 2004 IBM Corporation and others.
+ * Copyright (c) 1997, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp.translator.compiler;
@@ -52,6 +49,7 @@ public class JikesJspCompiler implements JspCompiler {
protected boolean isVerbose = false;
protected boolean isDeprecation = false;
protected int jdkSourceLevel;
+ protected Integer javaSourceLevel;
protected boolean useOptimizedClasspath = false;
protected String absouluteContextRoot = null;
@@ -69,6 +67,7 @@ public JikesJspCompiler(String absouluteContextRoot, JspClassloaderContext class
this.isVerbose = options.isVerbose();
this.isDeprecation = options.isDeprecation();
jdkSourceLevel = options.getJdkSourceLevel();
+ javaSourceLevel = options.getJavaSourceLevel();
out = new CharArrayWriter();
}
@@ -199,30 +198,33 @@ private List buildArgList(String source, List compilerOptions, String classpath)
argList.add("-deprecation");
}
- // Jikes must default to -source 1.3; override if jdkSourceLevel is set
- //487396.1 jdkSourceLevel is 15 by default now ... should get into if statement
argList.add("-source");
- if (jdkSourceLevel == 14) {
- argList.add("1.4");
- }
- else if (jdkSourceLevel == 15) {
- argList.add("1.5");
- }
- // PM04610 start
- else if (jdkSourceLevel == 16) {
- argList.add("1.6");
- }
- // PM04610 end
- else if (jdkSourceLevel == 17) {
- argList.add("1.7");
- }
- // 126902 start
- else if (jdkSourceLevel == 18) {
- argList.add("1.8");
- }
- // 126902 end
- else {
- argList.add("1.3");
+ if (javaSourceLevel != -1) { // 7183
+ argList.add(javaSourceLevel.toString());
+ } else {
+ // Jikes must default to -source 1.3; override if jdkSourceLevel is set
+ if (jdkSourceLevel == 14) {
+ argList.add("1.4");
+ }
+ else if (jdkSourceLevel == 15) {
+ argList.add("1.5");
+ }
+ // PM04610 start
+ else if (jdkSourceLevel == 16) {
+ argList.add("1.6");
+ }
+ // PM04610 end
+ else if (jdkSourceLevel == 17) {
+ argList.add("1.7");
+ }
+ // 126902 start
+ else if (jdkSourceLevel == 18) {
+ argList.add("1.8");
+ }
+ // 126902 end
+ else {
+ argList.add("1.3");
+ }
}
argList.add("-sourcepath");
diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/StandardJspCompiler.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/StandardJspCompiler.java
index 6b9f7552cbb7..643c91b6392a 100644
--- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/StandardJspCompiler.java
+++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/StandardJspCompiler.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 1997, 2004 IBM Corporation and others.
+ * Copyright (c) 1997, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp.translator.compiler;
@@ -53,7 +50,8 @@ public class StandardJspCompiler implements JspCompiler {
protected boolean isDebugEnabled = false;
protected boolean isVerbose = false;
protected boolean isDeprecation = false;
- protected int jdkSourceLevel;
+ protected int jdkSourceLevel;
+ protected Integer javaSourceLevel;
protected String javaEncoding = null;
protected String outputDir = null;
protected JavaCompiler compiler;
@@ -76,6 +74,7 @@ public StandardJspCompiler(JspClassloaderContext context, JspOptions options, St
this.isDeprecation = options.isDeprecation();
this.javaEncoding = options.getJavaEncoding();
this.jdkSourceLevel= options.getJdkSourceLevel();
+ this.javaSourceLevel = options.getJavaSourceLevel();
this.outputDir = options.getOutputDir().getPath();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)) {
@@ -184,29 +183,33 @@ private List buildArgList(List compilerOptions, String outputDirectory)
argList.add("-deprecation");
}
- //487396.1 jdkSourceLevel is 15 by default now ... should get into if statement
argList.add("-source");
- if (jdkSourceLevel == 14) {
- argList.add("1.4");
- }
- else if (jdkSourceLevel == 15) {
- argList.add("1.5");
- }
- //PM04610 start
- else if (jdkSourceLevel == 16) {
- argList.add("1.6");
- }
- //PM04610 end
- else if (jdkSourceLevel == 17) {
- argList.add("1.7");
- }
- //126902 start
- else if (jdkSourceLevel == 18) {
- argList.add("1.8");
- }
- //126902 end
- else {
- argList.add("1.3");
+ // issue 7183: look at javaSourceLevel first before using jdkSourceLevel
+ if (javaSourceLevel != -1) {
+ argList.add(javaSourceLevel.toString());
+ } else {
+ if (jdkSourceLevel == 14) {
+ argList.add("1.4");
+ }
+ else if (jdkSourceLevel == 15) {
+ argList.add("1.5");
+ }
+ //PM04610 start
+ else if (jdkSourceLevel == 16) {
+ argList.add("1.6");
+ }
+ //PM04610 end
+ else if (jdkSourceLevel == 17) {
+ argList.add("1.7");
+ }
+ //126902 start
+ else if (jdkSourceLevel == 18) {
+ argList.add("1.8");
+ }
+ //126902 end
+ else {
+ argList.add("1.3");
+ }
}
// Annotations don't need to be processed for JSPs.
diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/utils/JspFileManager.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/utils/JspFileManager.java
index 44fb885186c9..7b1bdc5baf1a 100644
--- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/utils/JspFileManager.java
+++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/utils/JspFileManager.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2016 IBM Corporation and others.
+ * Copyright (c) 2016, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jsp.translator.compiler.utils;
@@ -51,6 +48,7 @@
import org.osgi.framework.wiring.BundleWiring;
import com.ibm.ws.artifact.url.WSJarURLConnection;
+import com.ibm.ws.kernel.service.util.JavaInfo;
import com.ibm.wsspi.jsp.resource.translation.JspResources;
public class JspFileManager extends ForwardingJavaFileManager {
@@ -66,6 +64,8 @@ public class JspFileManager extends ForwardingJavaFileManager {
private static final String CLASS_NAME = "com.ibm.ws.jsp.translator.compiler.utils.JspFileManager";
private boolean areTagFiles = false;
+ private static int JAVA_MAJOR_VERSION = JavaInfo.majorVersion();
+
public JspFileManager(JavaFileManager fileManager, ClassLoader classLoader) {
super(fileManager);
this.classLoader = classLoader;
@@ -76,6 +76,12 @@ public JspFileManager(JavaFileManager fileManager, ClassLoader classLoader) {
}
}
+ // May be needed for Java Modules? Requires JDK 9+
+ // @Override
+ // public Iterable> listLocationsForModules(Location location) throws IOException, UnsupportedOperationException, IllegalArgumentException {
+ // return super.listLocationsForModules(location);
+ // }
+
@Override
public Iterable list(Location location, String packageName,
Set kinds, boolean recurse) throws IOException {
@@ -83,9 +89,10 @@ public Iterable list(Location location, String packageName,
logger.logp(Level.FINE, CLASS_NAME, "list", "Looking for classes in package = " + packageName + " from location = " + location.getName());
}
Iterable results = new ArrayList();
-
if (location == StandardLocation.PLATFORM_CLASS_PATH) // let standard manager handle
results = super.list(location, packageName, kinds, recurse);
+ else if (JAVA_MAJOR_VERSION >= 9 && location.getName().equals("SYSTEM_MODULES[java.base]")) // base module for 9+
+ results = super.list(location, packageName, kinds, recurse);
else if (location == StandardLocation.CLASS_PATH && kinds.contains(JavaFileObject.Kind.CLASS)) {
results = super.list(location, packageName, kinds, recurse);
/*
diff --git a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java
index d6eea1eed612..4001a2ec8b13 100644
--- a/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java
+++ b/dev/fattest.simplicity/src/com/ibm/websphere/simplicity/config/JspEngineElement.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.websphere.simplicity.config;
@@ -21,10 +18,12 @@ public class JspEngineElement extends ConfigElement {
private Boolean useStringCast;
private Boolean usescriptvardupinit;
private String jdkSourceLevel;
+ private String javaSourceLevel;
private Boolean disableResourceInjection;
private Boolean disableTldSearch;
private String scratchdir;
private Boolean keepGenerated;
+ private Boolean useJDKCompiler;
/**
* @return the useStringCast
@@ -62,6 +61,18 @@ public void setJdkSourceLevel(String s) {
this.jdkSourceLevel = s;
}
+ /**
+ * @return the javaSourceLevel
+ */
+ public String getJavaSourceLevel() {
+ return javaSourceLevel;
+ }
+
+ @XmlAttribute(name = "javaSourceLevel")
+ public void setJavaSourceLevel(String s) {
+ this.javaSourceLevel = s;
+ }
+
/**
* @return the disableResourceInjection
*/
@@ -95,7 +106,7 @@ public void setScratchdir(String value) {
public String getScratchdir() {
return scratchdir;
}
-
+
/**
* @return the keepGenerated
*/
@@ -108,6 +119,18 @@ public void setKeepGenerated(Boolean b) {
this.keepGenerated = b;
}
+ /**
+ * @return the keepGenerated
+ */
+ public Boolean isUseJDKCompiler() {
+ return useJDKCompiler;
+ }
+
+ @XmlAttribute(name = "useJDKCompiler")
+ public void setUseJDKCompiler(Boolean b) {
+ this.useJDKCompiler = b;
+ }
+
@Override
public String toString() {
StringBuffer buf = new StringBuffer("JspElement{");
@@ -117,6 +140,8 @@ public String toString() {
buf.append("usescriptvardupinit=\"" + usescriptvardupinit + "\" ");
if (jdkSourceLevel != null)
buf.append("jdkSourceLevel=\"" + jdkSourceLevel + "\" ");
+ if (javaSourceLevel != null)
+ buf.append("javaSourceLevel=\"" + javaSourceLevel + "\" ");
if (disableResourceInjection != null)
buf.append("disableResourceInjection=\"" + disableResourceInjection + "\" ");
if (disableTldSearch != null)
@@ -125,6 +150,8 @@ public String toString() {
buf.append("scratchdir=\"" + scratchdir + "\" ");
if (keepGenerated != null)
buf.append("keepGenerated=\"" + keepGenerated + "\" ");
+ if (useJDKCompiler != null)
+ buf.append("useJDKCompiler=\"" + useJDKCompiler + "\" ");
buf.append("}");
return buf.toString();
diff --git a/dev/io.openliberty.org.eclipse.jdt.core.java17/bnd.bnd b/dev/io.openliberty.org.eclipse.jdt.core.java17/bnd.bnd
index 837527ddeafa..b41e75fee85e 100644
--- a/dev/io.openliberty.org.eclipse.jdt.core.java17/bnd.bnd
+++ b/dev/io.openliberty.org.eclipse.jdt.core.java17/bnd.bnd
@@ -10,11 +10,11 @@
-include= ~../cnf/resources/bnd/bundle.props
bVersion=1.0
-# 3.35 (aka 4.29) added Java 21 support
+# 3.36 (aka 4.30) added Java 21 support
Bundle-Name: JDT Compiler
Bundle-SymbolicName: io.openliberty.org.eclipse.jdt.core.java17
-Bundle-Description: Eclipse Java Compiler (ECJ) from the Java Development Tools (JDT) Project. Version 3.35.0: Sept, 2023
+Bundle-Description: Eclipse Java Compiler (ECJ) from the Java Development Tools (JDT) Project. Version 3.36.0: Dec, 2023
javac.source: 17
javac.target: 17
@@ -23,6 +23,6 @@ Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=17))"
Import-Package: !*
-Export-Package: org.eclipse.jdt.*;version=3.35.0;usage=JSP
+Export-Package: org.eclipse.jdt.*;version=3.36.0;usage=JSP
--buildpath: org.eclipse.jdt:ecj;strategy=exact;version=3.35.0
+-buildpath: org.eclipse.jdt:ecj;strategy=exact;version=3.36.0