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