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

Oli Gillespie ogillespie at openjdk.org
Fri Feb 27 14:27:30 UTC 2026


On Fri, 27 Feb 2026 11:45:41 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> Oli Gillespie has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove @author tag and update copyright
>
> test/jdk/java/lang/management/RuntimeMXBean/InputArgument.java line 86:
> 
>> 84: 
>> 85:     public static void main(String args[]) throws Exception {
>> 86:         if (args.length > 0 && "generateFlagsFile".equals(args[0])) {
> 
> If it was "if args.length == 1 && ..." I would have understood it more quickly, 
> generateFlagsFile must be the only argument.

Thanks, updated.

> 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.

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

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


More information about the serviceability-dev mailing list