Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private void sync() {

@Override
public int hashCode() {
int bits = (int)(currentEncodedProperties ^ (currentEncodedProperties >>> 32));
int bits = Long.hashCode(currentEncodedProperties);
bits ^= nativeMap.hashCode();
bits ^= changes.hashCode();
return bits;
Expand Down
7 changes: 3 additions & 4 deletions src/java.desktop/macosx/classes/apple/laf/JRSUIState.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public boolean is(Property property) {

@Override
public int hashCode() {
return (int)(encodedState ^ (encodedState >>> 32)) ^ getClass().hashCode();
return Long.hashCode(encodedState) ^ getClass().hashCode();
}

public static class AnimationFrameState extends JRSUIState {
Expand Down Expand Up @@ -183,8 +183,7 @@ public boolean equals(final Object obj) {

@Override
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.

}
}

Expand Down Expand Up @@ -258,7 +257,7 @@ public boolean equals(final Object obj) {
@Override
public int hashCode() {
final long bits = Double.doubleToRawLongBits(thumbProportion) ^ Double.doubleToRawLongBits(thumbStart);
return super.hashCode() ^ (int)bits ^ (int)(bits >>> 32);
return super.hashCode() ^ Long.hashCode(bits);
}
}
}