-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
None
The jdk.test.lib.process.ProcessTools.createJavaProcessBuilder API is inconvenient when you want to pass some arguments only under certain conditions. You either have to build an ArrayList of arguments, or do hacks like this
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-Dx",
"TestApp");
This RFE proposes an enhancement to the API, so you can do things like:
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
ifDebug.use("-XX:-VerifyDependencies"),
"TestApp");
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
"TestApp",
ifCond(x == 0).use("x", "is", "zero").orElse().use("not", "zero"));
Note that the second example cannot be done with the current API. I.e., something like the following is not valid Java syntax.
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
"TestApp",
(x == 0) ? {"x", "is", "zero"} : {"not", "zero"});
See attachment for a rough draft of the proposal
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-Dx",
"TestApp");
This RFE proposes an enhancement to the API, so you can do things like:
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
ifDebug.use("-XX:-VerifyDependencies"),
"TestApp");
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
"TestApp",
ifCond(x == 0).use("x", "is", "zero").orElse().use("not", "zero"));
Note that the second example cannot be done with the current API. I.e., something like the following is not valid Java syntax.
ProcessTools.createJavaProcessBuilder("-cp", "foobar",
"TestApp",
(x == 0) ? {"x", "is", "zero"} : {"not", "zero"});
See attachment for a rough draft of the proposal