Fixed bug, thx to Don for the good catch
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1380 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -3,6 +3,7 @@ Added numbering to the HTMLRenderer; thx to Luke Francl for the code.
|
||||
Fixed bug 672742 - grammar typo was hosing up ASTConstructorDeclaration which was hosing up UseSingletonRule
|
||||
Fixed bug 674393 - OnlyOneReturn rule no longer counts returns that are inside anonymous inner classes as being inside the containing method. Thx to C. Lamont Gilbert for the bug report.
|
||||
Fixed bug 674420 - AvoidReassigningParametersRule no longer counts parameter field reassignment as a violation. Thx to C. Lamont Gilbert for the bug report.
|
||||
Fixed bug in OverrideBothEqualsAndHashcodeRule - it no longer bails out with a NullPtrException on interfaces that declare a method signature "equals(Object)". Thx to Don Leckie for catching that.
|
||||
|
||||
January 22, 2003 - 1.02:
|
||||
Added new rules: ImportFromSamePackageRule, SwitchDensityRule, NullAssignmentRule, UnusedModifierRule, ForLoopShouldBeWhileLoopRule
|
||||
|
@ -23,4 +23,7 @@ public class OverrideBothEqualsAndHashcodeRuleTest extends RuleTst {
|
||||
public void testEqualsSignatureUsesStringNotObject() throws Throwable{
|
||||
runTest("OverrideBothEqualsAndHashcode5.java", 1, new OverrideBothEqualsAndHashcodeRule());
|
||||
}
|
||||
public void testInterface() throws Throwable{
|
||||
runTest("OverrideBothEqualsAndHashcode6.java", 0, new OverrideBothEqualsAndHashcodeRule());
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import net.sourceforge.pmd.ast.ASTClassBody;
|
||||
import net.sourceforge.pmd.ast.ASTMethodDeclarator;
|
||||
import net.sourceforge.pmd.ast.AccessNode;
|
||||
import net.sourceforge.pmd.ast.SimpleNode;
|
||||
import net.sourceforge.pmd.ast.ASTInterfaceDeclaration;
|
||||
|
||||
public class OverrideBothEqualsAndHashcodeRule extends AbstractRule implements Rule {
|
||||
|
||||
@ -48,6 +49,10 @@ public class OverrideBothEqualsAndHashcodeRule extends AbstractRule implements R
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object visit(ASTInterfaceDeclaration node, Object data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object visit(ASTMethodDeclarator node, Object data) {
|
||||
AccessNode parent = (AccessNode)node.jjtGetParent();
|
||||
// hashcode has no params & (TODO) returns an int
|
||||
|
3
pmd/test-data/OverrideBothEqualsAndHashcode6.java
Normal file
3
pmd/test-data/OverrideBothEqualsAndHashcode6.java
Normal file
@ -0,0 +1,3 @@
|
||||
public interface OverrideBothEqualsAndHashcode6 {
|
||||
public boolean equals(Object o);
|
||||
}
|
Reference in New Issue
Block a user