Browse Source

Use '-Djava.security.manager=allow' on Java 18+ (JEP 411)

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>
tags/V1_9_9
Alexander Kriegisch 2 years ago
parent
commit
09d5772dba
2 changed files with 17 additions and 0 deletions
  1. 14
    0
      pom.xml
  2. 3
    0
      testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java

+ 14
- 0
pom.xml View File

@@ -207,6 +207,20 @@
<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>

+ 3
- 0
testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java View 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");

Loading…
Cancel
Save