From 09d5772dba8fa81ed6ee1a74ae7e7721cfc3787c Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Mon, 21 Mar 2022 11:30:38 +0700 Subject: [PATCH] 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 --- pom.xml | 14 ++++++++++++++ .../aspectj/testing/harness/bridge/JavaRun.java | 3 +++ 2 files changed, 17 insertions(+) diff --git a/pom.xml b/pom.xml index 3e988779c..d262f8d92 100644 --- a/pom.xml +++ b/pom.xml @@ -207,6 +207,20 @@ --add-opens java.base/java.lang=ALL-UNNAMED + + jdk-18-to-xx + + [18,) + + + + -Djava.security.manager=allow + + release diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java index 93ca14e70..fa3315396 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java @@ -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"); -- 2.39.5