diff --git a/pmd/src/net/sourceforge/pmd/AbstractRule.java b/pmd/src/net/sourceforge/pmd/AbstractRule.java index 1d0a083467..4d02936fc4 100644 --- a/pmd/src/net/sourceforge/pmd/AbstractRule.java +++ b/pmd/src/net/sourceforge/pmd/AbstractRule.java @@ -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() {