equals() in the object hierarchy must check for class

This commit is contained in:
Sergey Malenkov
2017-11-03 17:51:36 +03:00
parent d9578660a8
commit f487d41be1
2 changed files with 2 additions and 8 deletions
@@ -120,6 +120,8 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst
}
public boolean equals(Object object) {
if (object == this) return true;
if (object == null || !object.getClass().equals(getClass())) return false;
// we should not change this behaviour if value is set to null
return object instanceof AbstractTreeNode && Comparing.equal(myValue, ((AbstractTreeNode)object).myValue);
}
@@ -31,14 +31,6 @@ public class CustomResourceBundlePropertiesFileNode extends PsiFileNode implemen
data.setLocationString(PropertiesBundle.message("project.view.resource.bundle.tree.node.text", getResourceBundle().getBaseName()));
}
@Override
public boolean equals(Object object) {
if (!(object instanceof CustomResourceBundlePropertiesFileNode)) {
return false;
}
return Comparing.equal(getValue(), ((CustomResourceBundlePropertiesFileNode)object).getValue());
}
@NotNull
@Override
public ResourceBundle getResourceBundle() {