Added type check to equals()

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2049 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-06-30 15:15:49 +00:00
parent e5d3627fec
commit 4afb9fabd9

View File

@ -73,8 +73,10 @@ public abstract class AbstractRule extends JavaParserVisitorAdapter implements R
}
public boolean equals(Object o) {
Rule r = (Rule) o;
return r.getName().equals(getName());
if (!(o instanceof Rule)) {
return false;
}
return ((Rule)o).getName().equals(getName());
}
public int hashCode() {