Skip to content

Commit 124f823

Browse files
stsypanovmrserb
authored andcommitted
8268764: Use Long.hashCode() instead of int-cast where applicable
Reviewed-by: kevinw, prr, kizune, serb
1 parent 8657f77 commit 124f823

File tree

9 files changed

+21
-15
lines changed

9 files changed

+21
-15
lines changed

src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static DLSID read(RIFFReader riff) throws IOException {
105105

106106
@Override
107107
public int hashCode() {
108-
return (int)i1;
108+
return Long.hashCode(i1);
109109
}
110110

111111
@Override

src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,7 @@ public static GUID read(RIFFReader riff) throws IOException {
9191

9292
@Override
9393
public int hashCode() {
94-
return (int) i1;
94+
return Long.hashCode(i1);
9595
}
9696

9797
@Override

src/java.rmi/share/classes/java/rmi/server/ObjID.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ public static ObjID read(ObjectInput in) throws IOException {
199199
*
200200
* @return the hash code value for this object identifier
201201
*/
202+
@Override
202203
public int hashCode() {
203-
return (int) objNum;
204+
return Long.hashCode(objNum);
204205
}
205206

206207
/**

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@ public boolean equals(Object obj) {
175175

176176
@Override
177177
public int hashCode() {
178-
return (int) getMetaspaceMethod();
178+
return Long.hashCode(getMetaspaceMethod());
179179
}
180180

181181
/**

src/jdk.jdi/share/classes/com/sun/tools/jdi/FieldImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -51,8 +51,9 @@ public boolean equals(Object obj) {
5151
}
5252
}
5353

54+
@Override
5455
public int hashCode() {
55-
return (int)ref();
56+
return Long.hashCode(ref());
5657
}
5758

5859
public int compareTo(Field field) {

src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -95,8 +95,9 @@ public boolean equals(Object obj) {
9595
}
9696
}
9797

98+
@Override
9899
public int hashCode() {
99-
return (int)ref();
100+
return Long.hashCode(ref());
100101
}
101102

102103
public final List<Location> allLineLocations()

src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -155,8 +155,9 @@ public boolean equals(Object obj) {
155155
}
156156
}
157157

158+
@Override
158159
public int hashCode() {
159-
return(int)ref();
160+
return Long.hashCode(ref());
160161
}
161162

162163
public Type type() {

src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ public boolean equals(Object obj) {
150150
}
151151
}
152152

153+
@Override
153154
public int hashCode() {
154-
return(int)ref();
155+
return Long.hashCode(ref());
155156
}
156157

157158
public int compareTo(ReferenceType object) {

src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,8 @@ public boolean equals(Object o) {
100100
*
101101
* @return a hash code for this {@code NTNumericCredential}.
102102
*/
103+
@Override
103104
public int hashCode() {
104-
return (int)this.impersonationToken;
105+
return Long.hashCode(this.impersonationToken);
105106
}
106107
}

0 commit comments

Comments
 (0)