forked from phoedos/pmd
findChildrenOfType never returns null; it just returns an empty List if there aren't any found
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4758 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -36,7 +36,7 @@ public class AbstractOptimizationRule extends AbstractRule implements Rule {
|
||||
// TODO - symbol table?
|
||||
protected final String getVarName(ASTLocalVariableDeclaration node) {
|
||||
List l = node.findChildrenOfType(ASTVariableDeclaratorId.class);
|
||||
if (l != null && !l.isEmpty()) {
|
||||
if (!l.isEmpty()) {
|
||||
ASTVariableDeclaratorId vd = (ASTVariableDeclaratorId) l.get(0);
|
||||
return vd.getImage();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class ExceptionSignatureDeclaration extends AbstractRule {
|
||||
}
|
||||
|
||||
List exceptionList = methodDeclaration.findChildrenOfType(ASTName.class);
|
||||
if (!hasContent(exceptionList)) {
|
||||
if (!!exceptionList.isEmpty()) {
|
||||
return super.visit(methodDeclaration, o);
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class ExceptionSignatureDeclaration extends AbstractRule {
|
||||
|
||||
public Object visit(ASTConstructorDeclaration constructorDeclaration, Object o) {
|
||||
List exceptionList = constructorDeclaration.findChildrenOfType(ASTName.class);
|
||||
if (!hasContent(exceptionList)) {
|
||||
if (!!exceptionList.isEmpty()) {
|
||||
return super.visit(constructorDeclaration, o);
|
||||
}
|
||||
|
||||
@ -99,7 +99,4 @@ public class ExceptionSignatureDeclaration extends AbstractRule {
|
||||
return parent instanceof ASTMethodDeclaration || parent instanceof ASTConstructorDeclaration;
|
||||
}
|
||||
|
||||
private boolean hasContent(List nameList) {
|
||||
return nameList != null && !nameList.isEmpty();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user