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

8268113: Re-use Long.hashCode() where possible #4309

Closed
wants to merge 13 commits into from

Conversation

stsypanov
Copy link
Contributor

@stsypanov stsypanov commented Jun 2, 2021

There is a few JDK classes duplicating the contents of Long.hashCode() for hash code calculation. They should explicitly delegate to Long.hashCode().


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4309/head:pull/4309
$ git checkout pull/4309

Update a local copy of the PR:
$ git checkout pull/4309
$ git pull https://git.openjdk.java.net/jdk pull/4309/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4309

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4309.diff

@@ -1037,7 +1037,7 @@ public int hashCode() {
for (int i = wordsInUse; --i >= 0; )
h ^= words[i] * (i + 1);

return (int)((h >> 32) ^ h);
return Long.hashCode(h);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here >> instead of >>> in original code seems to be a typo

Copy link
Contributor

Choose a reason for hiding this comment

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

It is specified as >> in JavaDoc just above the implementation. As the algorithm is part of the public API and thus part of the specification, I don't think you can change it just here in the implementation; you'd need to at least submit a CSR for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I'll then revert this change

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 2, 2021

👋 Welcome back stsypanov! 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 Jun 2, 2021
@openjdk
Copy link

openjdk bot commented Jun 2, 2021

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

  • awt
  • core-libs
  • i18n
  • kulla

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 core-libs core-libs-dev@openjdk.org kulla kulla-dev@openjdk.org i18n i18n-dev@openjdk.org awt client-libs-dev@openjdk.org labels Jun 2, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 2, 2021

Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

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

All changes look good to me, though 3rd party sources like xerces/.../DoubleDV.java should probably be dealt with in the upstream first. @AlanBateman probably knows who maintains and downstreams this usually (or whether we are now practically maintaining a fork of xerces)?

@openjdk
Copy link

openjdk bot commented Aug 2, 2021

⚠️ @stsypanov the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout 8268113
$ git commit -c user.name='Preferred Full Name' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

openjdk bot commented Aug 2, 2021

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

8268113: Re-use Long.hashCode() where possible

Reviewed-by: redestad

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

  • 7cc1eb3: Merge
  • e351de3: 8271272: C2: assert(!had_error) failed: bad dominance
  • 6180cf1: 8271512: ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java due to 8270326
  • a1b5b81: 8271507: ProblemList SA tests that are failing with ZGC due to JDK-8248912
  • 4bc9b04: 8263059: security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java fails due to revoked cert
  • d6bb846: 8248899: security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java fails, Certificate has been revoked
  • 71ca0c0: 8270848: Redundant unsafe opmask register allocation in some instruction patterns.
  • 6c68ce2: 8270947: AArch64: C1: use zero_words to initialize all objects
  • cd7e30e: 8271242: Add Arena regression tests
  • 5b3c418: 8270321: Startup regressions in 18-b5 caused by JDK-8266310
  • ... and 62 more: https://git.openjdk.java.net/jdk/compare/36aefa351afeb5fd6b87060e06c1e8060afb87a0...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 (@cl4es) 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 Aug 2, 2021
@stsypanov
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 2, 2021
@openjdk
Copy link

openjdk bot commented Aug 2, 2021

@stsypanov
Your change (at version bd762b7) is now ready to be sponsored by a Committer.

@cl4es
Copy link
Member

cl4es commented Aug 2, 2021

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 2, 2021

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

  • 2536e43: 8270160: Remove redundant bounds check from AbstractStringBuilder.charAt()
  • 6c4c48f: 8266972: Use String.concat() in j.l.Class where invokedynamic-based String concatenation is not available
  • 72145f3: 8269665: Clean-up toString() methods of some primitive wrappers
  • 7cc1eb3: Merge
  • e351de3: 8271272: C2: assert(!had_error) failed: bad dominance
  • 6180cf1: 8271512: ProblemList serviceability/sa/sadebugd/DebugdConnectTest.java due to 8270326
  • a1b5b81: 8271507: ProblemList SA tests that are failing with ZGC due to JDK-8248912
  • 4bc9b04: 8263059: security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java fails due to revoked cert
  • d6bb846: 8248899: security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java fails, Certificate has been revoked
  • 71ca0c0: 8270848: Redundant unsafe opmask register allocation in some instruction patterns.
  • ... and 65 more: https://git.openjdk.java.net/jdk/compare/36aefa351afeb5fd6b87060e06c1e8060afb87a0...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 2, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and 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 Aug 2, 2021
@openjdk
Copy link

openjdk bot commented Aug 2, 2021

@cl4es @stsypanov Pushed as commit 6a3f834.

💡 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
awt client-libs-dev@openjdk.org core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org integrated Pull request has been integrated kulla kulla-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants