RFR: 8303884: jlink --add-options plugin does not allow GNU style options to be provided

Alan Bateman alanb at openjdk.org
Thu Dec 5 13:14:38 UTC 2024


On Tue, 3 Dec 2024 19:59:56 GMT, Henry Jen <henryjen at openjdk.org> wrote:

> Improving option value handling to support passing argument value starts with "--".
> 
> Before the fix, in following example, --add-modules will be considered as another option for JLink instead of argument value for --add-options.
> --add-options --add-modules=jdk.incubator.concurrent
> --add-options=--add-modules=jdk.incubator.concurrent
> 
> will cause JLink to report
> Error: no value given for --add-options
> as --add-modules is considered another option for JLink.
> 
> After the fix, by using = will ensure the value is properly handled as argument value. Also using "" with multiple values will be recognized properly. So following form should work
> --add-options "--add-modules jdk.incubator.concurrent"
> --add-options=--add-modules=jdk.incubator.concurrent

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java line 553:

> 551:                             param.charAt(0) == '-' && param.charAt(1) == '-' &&
> 552:                             !param.contains(" ")) {
> 553:                                 throw new BadArgs("err.missing.arg", name).showUsage(true);

This expression is hard to verify, would it possible to re-format it back to the original as that was much clearer to read.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22526#discussion_r1871361961


More information about the core-libs-dev mailing list