Harden equality of RuleSet objects
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3554 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -13,7 +13,7 @@ Fixed bug which caused MissingSerialVersionUID to trigger on all interfaces that
|
||||
Modified NullAssignmentRule to catch null assignments in ternary expressions.
|
||||
Added two new node types - ASTCatchStatement and ASTFinallyStatement.
|
||||
Modified rule XML definition; it no longer includes a symboltable attribute.
|
||||
Harden equality of AbstractRule objects (needed for the Eclipse plugin features)
|
||||
Harden equality of AbstractRule and RuleSet objects (needed for the Eclipse plugin features)
|
||||
|
||||
May 10, 2005 - 3.1:
|
||||
New rules: SimplifyStartsWith, UnnecessaryParentheses, CollapsibleIfStatements, UseAssertEqualsInsteadOfAssertTrue, UseAssertSameInsteadOfAssertTrue, UseStringBufferForStringAppends, SimplifyConditional, SingularField
|
||||
|
@ -124,4 +124,27 @@ public class RuleSet {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if ((o == null) || !(o instanceof RuleSet)) {
|
||||
return false; // Trivial
|
||||
}
|
||||
|
||||
if (this == o) {
|
||||
return true; // Basic equality
|
||||
}
|
||||
|
||||
RuleSet ruleSet = (RuleSet) o;
|
||||
return this.getName().equals(ruleSet.getName()) && this.getRules().equals(ruleSet.getRules());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public int hashCode() {
|
||||
return this.getName().hashCode() + 13*this.getRules().hashCode();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user