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

vy pushed a commit to branch 2.x-java-17
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 190092d0e5b436cc779d0e97fe425cb4b88a7491
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Fri Dec 1 21:40:05 2023 +0100

    More Java 8 fixes
---
 log4j-1.2-api/pom.xml   | 12 +++++++-----
 log4j-core-test/pom.xml | 27 +++++++++++++++++----------
 log4j-jpa/pom.xml       | 12 +++++++-----
 log4j-osgi-test/pom.xml | 12 +++++++-----
 4 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml
index 09ef006194..58c18dd5bc 100644
--- a/log4j-1.2-api/pom.xml
+++ b/log4j-1.2-api/pom.xml
@@ -161,17 +161,17 @@
 
   <profiles>
 
-    <!-- Relax reflective access constraints for tests -->
+    <!-- Fixes incompatible with Java 8 -->
     <profile>
 
-      <id>reflective-access-fixes</id>
+      <id>java8-incompat-fixes</id>
 
       <!-- CI uses Java 8 for running tests.
-           Though illegal access is disabled by default in Java 16 due to 
JEP-396.
-           Hence, we assume CI=Java8 and open modules only elsewhere.
+           Hence, we assume CI=Java8 and apply our changes elsewhere.
 
            One might think why not activate using `<jdk>[16,)` instead?
-           This doesn't work, since the match is not against "the JDK used by 
tests".
+           This doesn't work, since the match is not against "the JDK running 
tests", but "the JDK running Maven".
+           These two JDKs can differ due to Maven Toolchains.
            See `java8-tests` profile in `/pom.xml` for details. -->
       <activation>
         <property>
@@ -179,6 +179,8 @@
         </property>
       </activation>
 
+      <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
+           We are relaxing it for tests. -->
       <build>
         <plugins>
           <plugin>
diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index bc48791c98..fb79c45da2 100644
--- a/log4j-core-test/pom.xml
+++ b/log4j-core-test/pom.xml
@@ -297,11 +297,6 @@
       <artifactId>mockito-junit-jupiter</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.openjdk.nashorn</groupId>
-      <artifactId>nashorn-core</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
@@ -381,17 +376,17 @@
 
   <profiles>
 
-    <!-- Relax reflective access constraints for tests -->
+    <!-- Fixes incompatible with Java 8 -->
     <profile>
 
-      <id>reflective-access-fixes</id>
+      <id>java8-incompat-fixes</id>
 
       <!-- CI uses Java 8 for running tests.
-           Though illegal access is disabled by default in Java 16 due to 
JEP-396.
-           Hence, we assume CI=Java8 and open modules only elsewhere.
+           Hence, we assume CI=Java8 and apply our changes elsewhere.
 
            One might think why not activate using `<jdk>[16,)` instead?
-           This doesn't work, since the match is not against "the JDK used by 
tests".
+           This doesn't work, since the match is not against "the JDK running 
tests", but "the JDK running Maven".
+           These two JDKs can differ due to Maven Toolchains.
            See `java8-tests` profile in `/pom.xml` for details. -->
       <activation>
         <property>
@@ -399,6 +394,18 @@
         </property>
       </activation>
 
+      <!-- JEP-335 has deprecated the built-in JavaScript engine (Nashorn) in 
Java 11, and JEP-372 removed it in Java 15.
+           We are adding it back for tests that use JavaScript. -->
+      <dependencies>
+        <dependency>
+          <groupId>org.openjdk.nashorn</groupId>
+          <artifactId>nashorn-core</artifactId>
+          <scope>test</scope>
+        </dependency>
+      </dependencies>
+
+      <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
+           We are relaxing it for tests. -->
       <build>
         <plugins>
           <plugin>
diff --git a/log4j-jpa/pom.xml b/log4j-jpa/pom.xml
index df7a007434..54e535b2b6 100644
--- a/log4j-jpa/pom.xml
+++ b/log4j-jpa/pom.xml
@@ -121,17 +121,17 @@
 
   <profiles>
 
-    <!-- Relax reflective access constraints for tests -->
+    <!-- Fixes incompatible with Java 8 -->
     <profile>
 
-      <id>reflective-access-fixes</id>
+      <id>java8-incompat-fixes</id>
 
       <!-- CI uses Java 8 for running tests.
-           Though illegal access is disabled by default in Java 16 due to 
JEP-396.
-           Hence, we assume CI=Java8 and open modules only elsewhere.
+           Hence, we assume CI=Java8 and apply our changes elsewhere.
 
            One might think why not activate using `<jdk>[16,)` instead?
-           This doesn't work, since the match is not against "the JDK used by 
tests".
+           This doesn't work, since the match is not against "the JDK running 
tests", but "the JDK running Maven".
+           These two JDKs can differ due to Maven Toolchains.
            See `java8-tests` profile in `/pom.xml` for details. -->
       <activation>
         <property>
@@ -139,6 +139,8 @@
         </property>
       </activation>
 
+      <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
+           We are relaxing it for tests. -->
       <build>
         <plugins>
           <plugin>
diff --git a/log4j-osgi-test/pom.xml b/log4j-osgi-test/pom.xml
index 885fd510b4..b181d642cd 100644
--- a/log4j-osgi-test/pom.xml
+++ b/log4j-osgi-test/pom.xml
@@ -209,17 +209,17 @@
 
   <profiles>
 
-    <!-- Relax reflective access constraints for tests -->
+    <!-- Fixes incompatible with Java 8 -->
     <profile>
 
-      <id>reflective-access-fixes</id>
+      <id>java8-incompat-fixes</id>
 
       <!-- CI uses Java 8 for running tests.
-           Though illegal access is disabled by default in Java 16 due to 
JEP-396.
-           Hence, we assume CI=Java8 and open modules only elsewhere.
+           Hence, we assume CI=Java8 and apply our changes elsewhere.
 
            One might think why not activate using `<jdk>[16,)` instead?
-           This doesn't work, since the match is not against "the JDK used by 
tests".
+           This doesn't work, since the match is not against "the JDK running 
tests", but "the JDK running Maven".
+           These two JDKs can differ due to Maven Toolchains.
            See `java8-tests` profile in `/pom.xml` for details. -->
       <activation>
         <property>
@@ -227,6 +227,8 @@
         </property>
       </activation>
 
+      <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
+           We are relaxing it for tests. -->
       <build>
         <plugins>
           <plugin>

Reply via email to