RFR: 8316804: Gracefully handle the case where --release is not specified last [v3]
Jaikiran Pai
jpai at openjdk.org
Wed Dec 18 15:49:40 UTC 2024
On Thu, 12 Dec 2024 07:44:50 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> Please review this change for the `jar` tool to gracefully handle the case where `--release` is not specified as the last arguments.
>>
>> Prior to this commit, operation modes `-d --describe-module` and `--validate` expected to read the optional `--release` option as a file argument: `jar -d -f a.jar --release 9`
>> By adding a hidden GNU-style `--release` option, processing the optional arguments before in those two operation modes, the position is now no longer required to trail behind the `-f --file` option: `jar -d --release 9 -f a.jar`
>>
>>
>> ==============================
>> Test summary
>> ==============================
>> TEST TOTAL PASS FAIL ERROR
>> jtreg:test/jdk/tools/jar 26 26 0 0
>> ==============================
>> TEST SUCCESS
>
> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>
> Add two more valid use-cases
src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java line 231:
> 229: boolean isHidden() { return true; }
> 230: },
> 231: new Option(true, OptionType.OTHER, "--release") {
I think we should create a new `OptionType` for this one. If this is put under `OTHER`, then it will end up like this in the help text:
Other options:
-?, -h, --help[:compat] Give this, or optionally the compatibility, help
--help-extra Give help on extra options
--version Print program version
--release
That wouldn't be the right place for this option. Instead, I think we should create a `DESCRIBE_MODULE_OR_VALIDATE` `OptionType` and configure the necessary help text for that group and include `--release` option under that. That way it will show up something like:
Operation modifiers valid only in describe module and validate mode:
--release=VERSION ...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22079#discussion_r1890458538
More information about the core-libs-dev
mailing list