aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2022-03-23 11:55:22 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2022-03-23 11:55:22 +0700
commit63d5e3e893bd149245465de1610716930998dec8 (patch)
tree420989784f87ec0c449b4a759ba8582157cffa39 /testing
parent8c15d83a466843b5dba8ba454329baaca0080cc5 (diff)
downloadaspectj-63d5e3e893bd149245465de1610716930998dec8.tar.gz
aspectj-63d5e3e893bd149245465de1610716930998dec8.zip
Fix more LTW tests
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/RunSpec.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java
index d687ae86b..534ed6374 100644
--- a/testing/src/test/java/org/aspectj/testing/RunSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java
@@ -22,7 +22,7 @@ import java.util.StringTokenizer;
import org.aspectj.tools.ajc.AjcTestCase;
import org.aspectj.util.FileUtil;
-import static org.aspectj.util.LangUtil.is16VMOrGreater;
+import static org.aspectj.util.LangUtil.is9VMOrGreater;
/**
* @author Adrian Colyer
@@ -70,7 +70,11 @@ public class RunSpec implements ITestStep {
// On Java 16+, LTW no longer works without this parameter. Add the argument here and not in AjcTestCase::run,
// because even if 'useLTW' and 'useFullLTW' are not set, we might in the future have tests for weaver attachment
// during runtime. See also docs/dist/doc/README-187.html.
- vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : "";
+ //
+ // The reason for setting this parameter for Java 9+ instead of 16+ is that it helps to avoid the JVM printing
+ // unwanted illegal access warnings during weaving in 'useFullLTW' mode, either making existing tests fail or
+ // having to assert on the warning messages.
+ vmargs += is9VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : "";
AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw));