Skip to content
Permalink
Browse files
8264734: Some SA classes could use better hashCode() implementation
Reviewed-by: cjplummer, kevinw
  • Loading branch information
kariya-mitsuru authored and Kevin Walls committed May 17, 2021
1 parent 2313a21 commit a555fd89d040792d4de73ab67d86b171a38cfde6
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -52,8 +52,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@@ -56,8 +56,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -52,8 +52,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -52,8 +52,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -52,8 +52,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -387,7 +387,7 @@ int getThreadHashCode(long id) {
return remoteDebugger.getThreadHashCode(id, false);
} catch (RemoteException e) {
}
return (int) id;
return Long.hashCode(id);
}

public ThreadProxy getThreadForIdentifierAddress(Address addr) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -52,8 +52,7 @@ public boolean equals(Object arg) {
}

public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -75,7 +75,7 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@@ -78,7 +78,7 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}

public String toString() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@@ -74,7 +74,7 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}

public String toString() {
@@ -127,7 +127,7 @@ public Address end() {

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

@Override

1 comment on commit a555fd8

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on a555fd8 May 17, 2021

Please sign in to comment.