On Thu, 12 Dec 2024 07:44:50 GMT, Christian Stein <cst...@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 I had a look at this one today. The `jar --help` documentation states: Usage: jar [OPTION...] [ [--release VERSION] [-C dir] files] ... That usage implies that a `--release VERSION` must always be followed by file paths and there cannot be any options (like `-f` or `--file` for example) after a `--release VERSION` has been encountered. The help text further states: --release VERSION Places all following files in a versioned directory of the jar (i.e. META-INF/versions/VERSION/) So it appears that this `--release` option was at least initially envisioned only for determining where in the JAR the files will be placed. Interestingly, neither the help text nor the `jar` tool specification https://docs.oracle.com/en/java/javase/23/docs/specs/man/jar.html states anywhere that the `--release` option is supported by the `--describe-module` or the `--validate` operations. In fact, the `--validate` operation isn't mentioned in the `jar` tool specification at all. The lack of details for `--describe-module` and `--validate` in the `jar` tool specification will have to be addressed separately. What's being proposed here is that the `--release` option (followed by the release value) be allowed to be placed like any other `jar` tool option that follow the main operation. But this proposal limits this allowance only to the `--describe-module` and the `--validate` main operations. I think what's being proposed here is reasonable. @AlanBateman @LanceAndersen do you think this proposal is OK? As for the implementation specific detail of this change, I'll add some inline comments in the PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/22079#issuecomment-2551640171