Skip to content

Commit

Permalink
8268764: Use Long.hashCode() instead of int-cast where applicable
Browse files Browse the repository at this point in the history
Reviewed-by: kevinw, prr, kizune, serb
  • Loading branch information
stsypanov authored and mrserb committed Oct 12, 2021
1 parent 8657f77 commit 124f823
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static DLSID read(RIFFReader riff) throws IOException {

@Override
public int hashCode() {
return (int)i1;
return Long.hashCode(i1);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -91,7 +91,7 @@ public static GUID read(RIFFReader riff) throws IOException {

@Override
public int hashCode() {
return (int) i1;
return Long.hashCode(i1);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/java.rmi/share/classes/java/rmi/server/ObjID.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ public static ObjID read(ObjectInput in) throws IOException {
*
* @return the hash code value for this object identifier
*/
@Override
public int hashCode() {
return (int) objNum;
return Long.hashCode(objNum);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -175,7 +175,7 @@ public boolean equals(Object obj) {

@Override
public int hashCode() {
return (int) getMetaspaceMethod();
return Long.hashCode(getMetaspaceMethod());
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/jdk.jdi/share/classes/com/sun/tools/jdi/FieldImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -51,8 +51,9 @@ public boolean equals(Object obj) {
}
}

@Override
public int hashCode() {
return (int)ref();
return Long.hashCode(ref());
}

public int compareTo(Field field) {
Expand Down
5 changes: 3 additions & 2 deletions src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -95,8 +95,9 @@ public boolean equals(Object obj) {
}
}

@Override
public int hashCode() {
return (int)ref();
return Long.hashCode(ref());
}

public final List<Location> allLineLocations()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -155,8 +155,9 @@ public boolean equals(Object obj) {
}
}

@Override
public int hashCode() {
return(int)ref();
return Long.hashCode(ref());
}

public Type type() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ public boolean equals(Object obj) {
}
}

@Override
public int hashCode() {
return(int)ref();
return Long.hashCode(ref());
}

public int compareTo(ReferenceType object) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -100,7 +100,8 @@ public boolean equals(Object o) {
*
* @return a hash code for this {@code NTNumericCredential}.
*/
@Override
public int hashCode() {
return (int)this.impersonationToken;
return Long.hashCode(this.impersonationToken);
}
}

1 comment on commit 124f823

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.