diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-03-06 16:48:29 +0100 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-03-12 08:21:38 +0100 |
commit | 512d3fc281d2e56227e487dbf8ccee28cb63e589 (patch) | |
tree | 5eed6a8177b8bf49c35aea5e2efea71903fdfa40 | |
parent | 1f1d429752fd3ace6bc62f1aabea83e56e5818e4 (diff) | |
download | aspectj-512d3fc281d2e56227e487dbf8ccee28cb63e589.tar.gz aspectj-512d3fc281d2e56227e487dbf8ccee28cb63e589.zip |
AjcTestCase: Improve forked JVM parameter handling
- Recognise more "fork-worthy" JVM parameters
- Pass on program arguments to program in forked JVM
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r-- | org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 11b90c3b7..b76fe4ee0 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -694,10 +694,10 @@ public abstract class AjcTestCase extends TestCase { else if ( vmargs != null && ( vmargs.contains("--enable-preview") || - vmargs.contains("--add-modules") || - vmargs.contains("--limit-modules") || - vmargs.contains("--add-reads") || - vmargs.contains("--add-exports") + vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") || + vmargs.contains("--add-reads") || vmargs.contains("--add-exports") || vmargs.contains("--add-opens") || + vmargs.contains("-ea") || vmargs.contains("-enableassertions") || + vmargs.contains("-Xmx") ) ) { // If --add-modules supplied, need to fork the test @@ -708,7 +708,10 @@ public abstract class AjcTestCase extends TestCase { if (cp.indexOf("aspectjrt")==-1) { cp.append(pathSeparator).append(TestUtil.aspectjrtPath().getPath()); } - String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " " + className ; + String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " + + vmargs + + (cp.length() == 0 ? "" : " -classpath " + cp) + " " + + className + " " + String.join(" ", args); if (Ajc.verbose) System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance |