RFR: 8378110: Add -XX: prefix to settings-file flags in RuntimeMXBean.getInputArguments() [v2]

Kevin Walls kevinw at openjdk.org
Fri Feb 27 14:44:47 UTC 2026


On Fri, 27 Feb 2026 14:21:22 GMT, Oli Gillespie <ogillespie at openjdk.org> wrote:

>> test/jdk/java/lang/management/RuntimeMXBean/InputArgument.java line 97:
>> 
>>> 95: 
>>> 96:         List<String> options = rm.getInputArguments();
>>> 97:         if (vmOptions == null) {
>> 
>> An existing problem in the test, but getInputArguments() says: 
>> "returns an empty list if there is no input argument" 
>> ...so would be great if we can throw new RuntimeException("Null value from getInputArguments()") or simliar to cause a failure if it gets a null, while we are here.
>> 
>> (I was reading like this was meant to be if "options==null" as it is after we set options.  But maybe it's meant to be equivalent to a check for args.length ==0, it's just in an odd place.)
>
> I agree it's a bit convoluted, I think it's meant to be an args.length == 0 check. In practice it never hits anyway because even with no explicit args the test runner adds a bunch. Even with vm.flagless I get a few. I could add the assert but feels a bit misleading if we don't have any case that will actually exercise it.

OK sure yes.  Some of these older tests are showing their age.    If you have time, could we just make it do:
if (args.length > 0) {
    vmOptions = args;
} else {
    return ...
}
..so it's just trivial to read.  Looks like a trap right now, again an existing problem. 8-)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29793#discussion_r2864664278


More information about the serviceability-dev mailing list