RFR: 8316804: Gracefully handle the case where --release is not specified last [v3]
Jaikiran Pai
jpai at openjdk.org
Wed Dec 18 16:01:38 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 232:
> 230: },
> 231: new Option(true, OptionType.OTHER, "--release") {
> 232: void process(Main jartool, String opt, String arg) throws BadArgs {
This should now have an additional validation check that this `--release` option has been used only when `--describe-module` or `--validate` option has been specified. I realize that this proposed change currently does a check for these two main operations before invoking this option processing, but I think we should also include the main operation check here and throw option processing failure if the main operations aren't the ones we expect.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22079#discussion_r1890478181
More information about the core-libs-dev
mailing list