提交 b4e9fd77 编写于 作者: K khazra

8016576: Overrides warnings in jdi and jconsole

Summary: Implement hashCode() in classes emitting warnings
Reviewed-by: alanb, chegar
上级 5b4ace14
...@@ -171,7 +171,7 @@ class SDE { ...@@ -171,7 +171,7 @@ class SDE {
} }
public boolean equals(Object obj) { public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof LineStratum)) { if (obj instanceof LineStratum) {
LineStratum other = (LineStratum)obj; LineStratum other = (LineStratum)obj;
return (lti == other.lti) && return (lti == other.lti) &&
(sti == other.sti) && (sti == other.sti) &&
...@@ -182,6 +182,11 @@ class SDE { ...@@ -182,6 +182,11 @@ class SDE {
} }
} }
@Override
public int hashCode() {
return (lineNumber() * 17) ^ refType.hashCode();
}
int lineNumber() { int lineNumber() {
return stiLineNumber(sti, lti, jplsLine); return stiLineNumber(sti, lti, jplsLine);
} }
......
...@@ -27,6 +27,7 @@ package sun.tools.jconsole.inspector; ...@@ -27,6 +27,7 @@ package sun.tools.jconsole.inspector;
// java import // java import
import javax.swing.*; import javax.swing.*;
import java.util.Objects;
/** /**
* This provides a wrapper to the Object class to allow it to be * This provides a wrapper to the Object class to allow it to be
...@@ -48,18 +49,17 @@ public class XObject extends JLabel { ...@@ -48,18 +49,17 @@ public class XObject extends JLabel {
} }
public boolean equals(Object o) { public boolean equals(Object o) {
try { if (o instanceof XObject) {
if (o instanceof XObject) { return Objects.equals(object, ((XObject)o).getObject());
return object.equals(((XObject)o).getObject());
}
}
catch (Throwable t) {
System.out.println("Error comparing XObjects"+
t.getMessage());
} }
return false; return false;
} }
@Override
public int hashCode() {
return object.hashCode();
}
public Object getObject() { public Object getObject() {
return object; return object;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册