Skip to content

Commit 2661f62

Browse files
committed
8356036: (fs) FileKey.hashCode and UnixFileStore.hashCode implementations can use Long.hashCode
Reviewed-by: liach, bpb
1 parent bed29a0 commit 2661f62

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/java.base/unix/classes/sun/nio/ch/FileKey.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public static FileKey create(FileDescriptor fd) throws IOException {
4949

5050
@Override
5151
public int hashCode() {
52-
return (int)(st_dev ^ (st_dev >>> 32)) +
53-
(int)(st_ino ^ (st_ino >>> 32));
52+
return Long.hashCode(st_dev) + Long.hashCode(st_ino);
5453
}
5554

5655
@Override

src/java.base/unix/classes/sun/nio/fs/UnixFileKey.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class UnixFileKey {
4040

4141
@Override
4242
public int hashCode() {
43-
return (int)(st_dev ^ (st_dev >>> 32)) +
44-
(int)(st_ino ^ (st_ino >>> 32));
43+
return Long.hashCode(st_dev) + Long.hashCode(st_ino);
4544
}
4645

4746
@Override

src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public boolean equals(Object ob) {
241241

242242
@Override
243243
public int hashCode() {
244-
return (int)(dev ^ (dev >>> 32)) ^ Arrays.hashCode(entry.dir());
244+
return Long.hashCode(dev) ^ Arrays.hashCode(entry.dir());
245245
}
246246

247247
@Override

0 commit comments

Comments
 (0)