Implemented CompareObjectsWithEquals and put it in the design ruleset; it misses some cases, but it's a start

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3589 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2005-06-15 22:00:35 +00:00
parent 4e78e9dc3f
commit abc5f1abe4
2 changed files with 2 additions and 21 deletions

View File

@ -87,7 +87,7 @@ public class LocalScopeTest extends STBBaseTst {
ASTLocalVariableDeclaration node = (ASTLocalVariableDeclaration)acu.findChildrenOfType(ASTLocalVariableDeclaration.class).get(0);
LocalScope scope = (LocalScope)node.getScope();
MethodScope ms = scope.getEnclosingMethodScope();
assertEquals(2, ms.getVariableDeclarations().size());
}
@ -116,7 +116,7 @@ public class LocalScopeTest extends STBBaseTst {
public static final String TEST4 =
"public class Foo {" + PMD.EOL +
" void foo(String x) { int y; }" + PMD.EOL +
" void foo(String x, String z) { int y; }" + PMD.EOL +
"}";
}

View File

@ -32,25 +32,6 @@ public class Foo {
</rule>
-->
<rule name="CompareObjectsWithEquals"
message="Use equals() to compare object references."
class="net.sourceforge.pmd.rules.design.CompareObjectsWithEquals">
<description>
Use equals() to compare object references; don't compare them with ==.
</description>
<priority>3</priority>
<example>
<![CDATA[
class Foo {
boolean bar(String a, String b) {
return a == b;
}
}
]]>
</example>
</rule>