On Fri, 17 Jul 2026 07:08:31 GMT, Jaikiran Pai <[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). > > I think this will need inputs from Alan @AlanBateman. > > Although it seems reasonable to support this, since `java --help` does state: > >> To specify an argument for a long option, you can use --<name>=<value> or > --<name> <value>. > > But no where in the three JEPs that introduced the > `--illegal-final-field-mutation` (https://openjdk.org/jeps/500), > `--illegal-access` > (https://openjdk.org/jeps/261#Relaxed-strong-encapsulation) and > `--illegal-native-access` (https://openjdk.org/jeps/472) do I see a > mention/example of using it without the `=` sign. @jaikiran just had another look at the `--help` output, and especially these are interesting: --enable-native-access <module name>[,<module name>...] allow code in modules to access code and data outside the Java runtime. <module name> can also be ALL-UNNAMED to indicate code on the class path. --illegal-native-access=<value> allow or deny access to code and data outside the Java runtime by code in modules for which native access is not explicitly enabled. <value> is one of "deny", "warn" or "allow". The default value is "warn". This option will be removed in a future release. --enable-final-field-mutation <module name>[,<module name>...] allow code in the specified modules to mutate final instance fields. <module name> can also be ALL-UNNAMED to indicate code on the class path. --illegal-final-field-mutation=<value> allow or deny final field mutation by code in modules for which final field mutation is not explicitly enabled. <value> is one of "deny", "warn", "debug", or "allow". The default value is "warn". This option will be removed in a future release. Based on your remark, if an option is documented with a space, an `=` could be used as well, but not the other way around. With the current description I consider every double-dashed argument as a --long-option, so I would expect both separators are valid. ------------- PR Comment: https://git.openjdk.org/jdk/pull/31928#issuecomment-5000222840
