-
Notifications
You must be signed in to change notification settings - Fork 6k
8266835: Add a --validate option to the jar tool #3971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back jvernee! A progress list of the required criteria for merging this PR into |
@JornVernee The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
/label remove compiler |
@JornVernee |
- indent option in help message (to align with others)
/csr needed |
@JornVernee this pull request will not be integrated until the CSR request JDK-8267402 for issue JDK-8266835 has been approved. |
Webrevs
|
This all looks reasonable, I just wonder if the --validate description in the help output should provide a brief summary on what it does check. We can add to it as some validation is added. Without it then people will make assumptions on what it does. |
@AlanBateman Thanks for the suggestion. I think adding a description is good idea. I initially left the description vague, so that the behavior could be more easily amended. But, on second thought, such changes would seemingly require no less review, so I think it's better to include a description, as suggested. I've updated the description to say the following:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good
If the changes look good like this, please review the accompanying CSR for the command line option changes: https://bugs.openjdk.java.net/browse/JDK-8267402 Thanks |
src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
Outdated
Show resolved
Hide resolved
@JornVernee This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 462 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
@JornVernee Since your change was applied there have been 463 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 79010f2. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3971/head:pull/3971
$ git checkout pull/3971
Update a local copy of the PR:
$ git checkout pull/3971
$ git pull https://git.openjdk.java.net/jdk pull/3971/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3971
View PR using the GUI difftool:
$ git pr show -t 3971
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3971.diff