Skip to content

Conversation

@wenshao
Copy link
Contributor

@wenshao wenshao commented May 1, 2025

Similar to #24959 and #24971 and #24987, apple.laf.JRSUIControl and apple.laf.JRSUIState in java.desktop can also be simplified similarly.

Replace manual bitwise operations in hashCode implementations of JRSUIControl/JRSUIState with Long::hashCode.


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-8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hashCode (Enhancement - P5)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24989

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 1, 2025

👋 Welcome back swen! 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.

@wenshao wenshao changed the title JRSUIControl.hashCode and JRSUIState.hashCode and JRSUIState$AnimationFrameState/TitleBarHeightState.hashCode can use Long.hasCode JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hasCode May 1, 2025
@openjdk
Copy link

openjdk bot commented May 1, 2025

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

8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hashCode

Reviewed-by: prr, serb

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

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 master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented May 1, 2025

@wenshao The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label May 1, 2025
@wenshao wenshao marked this pull request as ready for review May 1, 2025 17:29
@wenshao wenshao marked this pull request as draft May 2, 2025 14:55
@wenshao wenshao marked this pull request as ready for review May 9, 2025 08:10
@wenshao wenshao changed the title JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hasCode 8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hasCode May 9, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label May 9, 2025
@mlbridge
Copy link

mlbridge bot commented May 9, 2025

Webrevs

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

I'm not entirely convinced this "simplification" was worth anyone's time to understand and review. I've run tests and I don't see any failures, but it wasn't likely something we have a test for.
You'll need to fix the PR name

public int hashCode() {
final long bits = Double.doubleToRawLongBits(value);
return super.hashCode() ^ (int)bits ^ (int)(bits >>> 32);
return super.hashCode() ^ Double.hashCode(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this uses Double.hashCode() not Long.hashCode() it would have been nice to have some comments on that. It took a bit of reading and following to learn that Double.hashCode() first uses Double.doubleToRawLongBits and then calls out to Long.hashCode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double.hashCode is a simple call, and there are no comments in other places where Double.hashCode is used in the JDK source code.

@wenshao wenshao changed the title 8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hasCode 8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hashCode May 12, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 12, 2025
@wenshao
Copy link
Contributor Author

wenshao commented May 12, 2025

I'm not entirely convinced this "simplification" was worth anyone's time to understand and review. I've run tests and I don't see any failures, but it wasn't likely something we have a test for. You'll need to fix the PR name

@pprace, thank you for reviewing this PR. I will follow your advice and will not submit similar PRs in the client module.

@wenshao
Copy link
Contributor Author

wenshao commented May 13, 2025

/integrate

@openjdk
Copy link

openjdk bot commented May 13, 2025

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 13, 2025
@openjdk openjdk bot closed this May 13, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 13, 2025
@openjdk
Copy link

openjdk bot commented May 13, 2025

@wenshao Pushed as commit 1bded71.

💡 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

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants