]> source.dussan.org Git - aspectj.git/commitdiff
Use '-Djava.security.manager=allow' on Java 18+ (JEP 411)
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 21 Mar 2022 04:30:38 +0000 (11:30 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 23 Mar 2022 01:04:17 +0000 (08:04 +0700)
JEP 411: Deprecate the Security Manager for Removal,
see https://openjdk.java.net/jeps/411.

As of Java 18, the new API for blocking System.exit is not available
yet, see https://bugs.openjdk.java.net/browse/JDK-8199704.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
pom.xml
testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java

diff --git a/pom.xml b/pom.xml
index 3e988779c9c75475c3a9fff275145e20a3f3cf79..d262f8d920be6fc6b1407f1393875b48e93c4b1c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                <jvm.arg.addOpens>--add-opens java.base/java.lang=ALL-UNNAMED</jvm.arg.addOpens>
                        </properties>
                </profile>
+               <profile>
+                       <id>jdk-18-to-xx</id>
+                       <activation>
+                               <jdk>[18,)</jdk>
+                       </activation>
+                       <properties>
+                               <!--
+                                       JEP 411: Deprecate the Security Manager for Removal, see https://openjdk.java.net/jeps/411.
+                                       As of Java 18, the new API for blocking System.exit is not available yet, see
+                                       https://bugs.openjdk.java.net/browse/JDK-8199704.
+                               -->
+                               <jvm.arg.addOpens>-Djava.security.manager=allow</jvm.arg.addOpens>
+                       </properties>
+               </profile>
                <profile>
                        <id>release</id>
                        <properties>
index 93ca14e70bd4a25260de3b66a6f93de90e951727..fa3315396f343a6ad35c6b20097e6badc7bea39a 100644 (file)
@@ -600,6 +600,9 @@ public class JavaRun implements IAjcRun {
        public static class Spec extends AbstractRunSpec {
                static {
                        try {
+                               // TODO: Deprecate the Security Manager for Removal, see https://openjdk.java.net/jeps/411.
+                               //       As of Java 18, the new API for blocking System.exit is not available yet, see
+                               //       https://bugs.openjdk.java.net/browse/JDK-8199704.
                                System.setSecurityManager(RunSecurityManager.ME);
                        } catch (Throwable t) {
                                System.err.println("JavaRun: Security manager set - no System.exit() protection");