On Tue, 18 Aug 2026 04:45:29 GMT, Guanqiang Han <[email protected]> wrote:

>> Please review this change, thanks!
>> 
>> **Description:**
>> 
>> Some VM long options only accept arguments in the `--option=value` form, 
>> even though the launcher help states that long-option arguments may also be 
>> separated by whitespace. As a result, options such as 
>> `--illegal-final-field-mutation debug`, `--illegal-native-access warn`  are 
>> not parsed correctly.
>> 
>> **Solution:**
>> 
>> Add `IsNonModuleVMWhiteSpaceOption()` to identify VM long options that 
>> accept whitespace-separated arguments and convert them to the 
>> `--option=value` form before passing them to the VM. Add 
>> `--enable-final-field-mutation` to the existing module-option handling. 
>> Normalize missing arguments for other VM long options to `--option=` so that 
>> they can be handled by the existing option validation logic.
>> 
>> **Test:**
>> 
>> GHA
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Guanqiang Han has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Unify test launch

Changes requested by bchristi (Reviewer).

test/jdk/java/lang/Object/FinalizationOption.java line 126:

> 124:     }
> 125: 
> 126:     public static void main(String[] args) throws Exception {

I think it's worth some comments explaining that each `@run` will call `main()` 
*twice*: once by jtreg with *two* arguments (which calls `launch()` and exits), 
and then again by `launch()`/`executeJavaTest()`, with *one* argument, which 
continues to execute the remainder of the `main()` method.

test/jdk/java/lang/Object/FinalizationOption.java line 130:

> 128:             launch(args[0], args[1]);
> 129:             return;
> 130:         }

It would further clarify things if main() threw an exception if args.length was 
neither 2 nor 1.

test/jdk/java/lang/Object/FinalizationOption.java line 146:

> 144:             throw new AssertionError("Test failed.");
> 145:     }
> 146: }

You might consider moving the code after the `args` counting into its own 
method, for further clarity.

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

PR Review: https://git.openjdk.org/jdk/pull/31928#pullrequestreview-4976526330
PR Review Comment: https://git.openjdk.org/jdk/pull/31928#discussion_r3816539809
PR Review Comment: https://git.openjdk.org/jdk/pull/31928#discussion_r3816533006
PR Review Comment: https://git.openjdk.org/jdk/pull/31928#discussion_r3816528959

Reply via email to