Skip to content
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

8297301: Cleanup unused methods in JavaUtilJarAccess #11072

Closed
wants to merge 8 commits into from

Conversation

pandaapo
Copy link
Contributor

@pandaapo pandaapo commented Nov 10, 2022

The cache named signerToCodeSource in JarVerifier is never used now.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8297301: Cleanup unused methods in JavaUtilJarAccess

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11072/head:pull/11072
$ git checkout pull/11072

Update a local copy of the PR:
$ git checkout pull/11072
$ git pull https://git.openjdk.org/jdk pull/11072/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11072

View PR using the GUI difftool:
$ git pr show -t 11072

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11072.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 10, 2022

👋 Welcome back pandaapo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 10, 2022
@openjdk
Copy link

openjdk bot commented Nov 10, 2022

@pandaapo The following labels will be automatically applied to this pull request:

  • core-libs
  • security

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.

@openjdk openjdk bot added security security-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Nov 10, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 10, 2022

@wangweij
Copy link
Contributor

/label remove core-libs

@openjdk openjdk bot removed the core-libs core-libs-dev@openjdk.org label Nov 10, 2022
@openjdk
Copy link

openjdk bot commented Nov 10, 2022

@wangweij
The core-libs label was successfully removed.

@wangweij
Copy link
Contributor

The method is not called since JDK 9, and that's why I set Affected Version/s to 8-pool. We don't intend to fix this in the current release.

@pandaapo
Copy link
Contributor Author

The method is not called since JDK 9, and that's why I set Affected Version/s to 8-pool. We don't intend to fix this in the current release.

Oh. Could you tell me where I should submit this PR? jdk8u?

@wangweij
Copy link
Contributor

I'm not sure. You can probably ask on jdk8u-dev@openjdk.java.net.

@seanjmullan
Copy link
Member

If you want to instead do some general cleanup in this class for JDK 20, you could instead remove this method and several other unused methods from JarVerifier.

@pandaapo
Copy link
Contributor Author

pandaapo commented Nov 11, 2022

If you want to instead do some general cleanup in this class for JDK 20, you could instead remove this method and several other unused methods from JarVerifier.

Before I began to make general cleanup, I looked up from this unused method JarVerifier#mapSignersToCodeSource()and found all related call stacks:
未命名文件
Can I also remove these methods from JarFile, JavaUtilJarAccess and its only implementation JavaUtilJarAccessImpl?

@seanjmullan
Copy link
Member

If you want to instead do some general cleanup in this class for JDK 20, you could instead remove this method and several other unused methods from JarVerifier.

Before I began to make general cleanup, I looked up from this unused method JarVerifier#mapSignersToCodeSource()and found all related call stacks: 未命名文件 Can I also remove these methods from JarFile, JavaUtilJarAccess and its only implementation JavaUtilJarAccessImpl?

Yes. I believe the setEagerValidation method can also be removed and all code that calls it.

@pandaapo
Copy link
Contributor Author

pandaapo commented Nov 16, 2022

Yes. I believe the setEagerValidation method can also be removed and all code that calls it.

OK, I will remove it and all methods that calls it:
jdk issue 8296734 .

Because JarVerifier#setEagerValidation will be removed, the field eagerValidation will always be false.

There are some codes using this field:
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/jar/JarVerifier.java#L361-L381
Can I remove the eagerValidation condition from if(eagerValidation && sigFileSigners.get(name) != null)?

If I can, can I remove this field from JarVerifier then?

@seanjmullan
Copy link
Member

Because JarVerifier#setEagerValidation will be removed, the field eagerValidation will always be false.

There are some codes using this field: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/jar/JarVerifier.java#L361-L381 Can I remove the eagerValidation condition from if(eagerValidation && sigFileSigners.get(name) != null)?

You can remove the whole if block since eagerValidation will never be true, and this block was only performed if it was true.

If I can, can I remove this field from JarVerifier then?

Yes.

@pandaapo
Copy link
Contributor Author

pandaapo commented Nov 17, 2022

Because JarVerifier#setEagerValidation will be removed, the field eagerValidation will always be false.
There are some codes using this field: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/jar/JarVerifier.java#L361-L381 Can I remove the eagerValidation condition from if(eagerValidation && sigFileSigners.get(name) != null)?

You can remove the whole if block since eagerValidation will never be true, and this block was only performed if it was true.

OK, then the first param JarFile jar of this method will be redundant, I will refactor it and related codes.

@wangweij
Copy link
Contributor

Great to see more lines removed. Since entries2 in JavaUtilJarAccess is removed, I assume the entries2 in JarFile is also useless, and there are 2 newEntry methods who claims to be invoked by entries2. Also, in JarVerifier, it seems all lines after // Extended JavaUtilJarAccess CodeSource API Support before isTrustedManifestEntry are related to those removed methods.

@wangweij
Copy link
Contributor

wangweij commented Nov 19, 2022

BTW, since this bug description is about a coding error but your fix is all cleanup, how about I file another bug and you use it in the title? I am trying to add a noreg-cleanup label to the bug and it does not apply to the jdk8u fix (suppose there will be one).

@pandaapo
Copy link
Contributor Author

pandaapo commented Nov 19, 2022

since this bug description is about a coding error but you fix is about cleanup, how about I file another bug and you use it in the title?

OK. Thanks.

I am trying to add a noreg-cleanup label to the bug and it does not apply to the jdk8u fix (suppose there will be one).

I had sent an email to jdk8u-dev@openjdk.java.net for asking which repository I can fork if I want to fix 8296734. And still waiting for reply.

@wangweij
Copy link
Contributor

I just filed https://bugs.openjdk.org/browse/JDK-8297301.

@pandaapo pandaapo changed the title 8296734: JarVerifier:: mapSignersToCodeSource should cache in map 8297301: Cleanup unused methods in JavaUtilJarAccess Nov 20, 2022
@AlanBateman
Copy link
Contributor

/label add core-libs

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Nov 20, 2022
@openjdk
Copy link

openjdk bot commented Nov 20, 2022

@AlanBateman
The core-libs label was successfully added.

@wangweij
Copy link
Contributor

codomain, VerifierCodeSource, isSigningRelated, and getUnsignedCS also used nowhere.

@pandaapo
Copy link
Contributor Author

codomain, VerifierCodeSource, isSigningRelated, and getUnsignedCS also used nowhere.

Thanks. I think your codomain must mean csdomain.

Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost complete. Just 2 small comments.

Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks fine now. Thanks so much for the cleanup. It's always nice to see unused lines removed.

@openjdk
Copy link

openjdk bot commented Nov 22, 2022

@pandaapo 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:

8297301: Cleanup unused methods in JavaUtilJarAccess

Reviewed-by: weijun

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 54 new commits pushed to the master branch:

  • 392ac70: 8297211: Expensive fillInStackTrace operation in HttpURLConnection.getOutputStream0 when no content-length in response
  • 5a45c25: 8297164: Update troff man pages and CheckManPageOptions.java
  • f12710e: 8288047: Accelerate Poly1305 on x86_64 using AVX512 instructions
  • cd6a203: 8297348: make CONF=xxx should match if xxx is an exact match
  • 817e039: 8297352: configure should check pandoc version
  • 15e2e28: 8297353: Regenerated checked-in html files with new pandoc
  • b366d17: 8294073: Performance improvement for message digest implementations
  • 57f5cfd: 8296399: crlNumExtVal might be null inside X509CRLSelector::match
  • 0b04a99: 8297347: Problem list compiler/debug/TestStress*.java
  • 0ac0148: 8297342: make LOG=debug is too verbose
  • ... and 44 more: https://git.openjdk.org/jdk/compare/ab6b7ef98800bee5e87e39a616af642874eb154a...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@wangweij) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 22, 2022
@pandaapo
Copy link
Contributor Author

Everything looks fine now. Thanks so much for the cleanup. It's always nice to see unused lines removed.

Thank you for your review.

@pandaapo
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 22, 2022
@openjdk
Copy link

openjdk bot commented Nov 22, 2022

@pandaapo
Your change (at version 1aa65b2) is now ready to be sponsored by a Committer.

@wangweij
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 22, 2022

Going to push as commit f0e99c6.
Since your change was applied there have been 54 commits pushed to the master branch:

  • 392ac70: 8297211: Expensive fillInStackTrace operation in HttpURLConnection.getOutputStream0 when no content-length in response
  • 5a45c25: 8297164: Update troff man pages and CheckManPageOptions.java
  • f12710e: 8288047: Accelerate Poly1305 on x86_64 using AVX512 instructions
  • cd6a203: 8297348: make CONF=xxx should match if xxx is an exact match
  • 817e039: 8297352: configure should check pandoc version
  • 15e2e28: 8297353: Regenerated checked-in html files with new pandoc
  • b366d17: 8294073: Performance improvement for message digest implementations
  • 57f5cfd: 8296399: crlNumExtVal might be null inside X509CRLSelector::match
  • 0b04a99: 8297347: Problem list compiler/debug/TestStress*.java
  • 0ac0148: 8297342: make LOG=debug is too verbose
  • ... and 44 more: https://git.openjdk.org/jdk/compare/ab6b7ef98800bee5e87e39a616af642874eb154a...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 22, 2022
@openjdk openjdk bot closed this Nov 22, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Nov 22, 2022
@openjdk
Copy link

openjdk bot commented Nov 22, 2022

@wangweij @pandaapo Pushed as commit f0e99c6.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants