forked from phoedos/pmd
We can just call iterater(); no need to call isEmpty() first
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4759 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -28,15 +28,13 @@ public class AvoidFieldNameMatchingMethodName extends AbstractRule {
|
||||
ASTClassOrInterfaceDeclaration cl = (ASTClassOrInterfaceDeclaration) node.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class);
|
||||
if (cl != null) {
|
||||
List methods = cl.findChildrenOfType(ASTMethodDeclaration.class);
|
||||
if (!methods.isEmpty()) {
|
||||
for (Iterator it = methods.iterator(); it.hasNext();) {
|
||||
ASTMethodDeclaration m = (ASTMethodDeclaration) it.next();
|
||||
//Make sure we are comparing fields and methods inside same type
|
||||
if (fieldDeclaringType.equals(getDeclaringType(m))) {
|
||||
String n = m.getMethodName();
|
||||
if (varName.equals(n.toLowerCase())) {
|
||||
addViolation(data, node);
|
||||
}
|
||||
for (Iterator it = methods.iterator(); it.hasNext();) {
|
||||
ASTMethodDeclaration m = (ASTMethodDeclaration) it.next();
|
||||
//Make sure we are comparing fields and methods inside same type
|
||||
if (fieldDeclaringType.equals(getDeclaringType(m))) {
|
||||
String n = m.getMethodName();
|
||||
if (varName.equals(n.toLowerCase())) {
|
||||
addViolation(data, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user