RFR: 8266835: Add a --validate option to the jar tool [v3]

Jorn Vernee jvernee at openjdk.java.net
Tue Jun 8 18:32:36 UTC 2021


> This patch adds a `--validate` option to the jar tool which can be used to validate a jar file that might be malformed. For instance, if a jar is a multi-release jar, it is malformed if different versions expose different APIs.
> 
> The implementation is straight forward since there already exists validation logic that is run when creating or updating a jar. This patch just exposes that logic directly under a new command line flag.
> 
> I've enhanced the existing ApiValidatorTest to also create malformed jars using the zip file APIs (the jar tool does not output malformed jars) and run them through `jar --validate`.
> 
> Note that while the jdk's jar tool does not output malformed jars, third-party archiving tools might, or the jar could have been manually edited.
> 
> Some prior discussion here: https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-May/077420.html
> 
> Testing: running jdk/tools/jar test suite locally, tier 1-3 (in progress), manual testing.

Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:

  Improve help message.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3971/files
  - new: https://git.openjdk.java.net/jdk/pull/3971/files/cbd6e81b..c4cfe847

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3971&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3971&range=01-02

  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3971.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3971/head:pull/3971

PR: https://git.openjdk.java.net/jdk/pull/3971


More information about the core-libs-dev mailing list