PMD on PMD: UseCollectionIsEmpty

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4751 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2006-10-26 18:41:49 +00:00
parent b022eaf244
commit 2e3a00b084
4 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ public class SingularField extends AbstractRule {
}
}
if (violation && usages.size() != 0) {
if (violation && !usages.isEmpty()) {
addViolation(data, node, new Object[] { declaration.getImage() });
}
}

View File

@ -69,7 +69,7 @@ public class PreserveStackTrace extends AbstractRule {
try {
List lst = args.findChildNodesWithXPath("//Name[@Image='" + target
+ "']");
if (lst.size() == 0) {
if (lst.isEmpty()) {
RuleContext ctx = (RuleContext) data;
addViolation(ctx, throwStatement);
}

View File

@ -223,7 +223,7 @@ public class ConsecutiveLiteralAppends extends AbstractRule {
*/
private boolean isAdditive(SimpleNode n) {
List lstAdditive = n.findChildrenOfType(ASTAdditiveExpression.class);
if (lstAdditive.size() == 0) {
if (lstAdditive.isEmpty()) {
return false;
}
// if there are more than 1 set of arguments above us we're not in the

View File

@ -213,9 +213,9 @@ public class InsufficientStringBufferDeclaration extends AbstractRule {
}
}
literal = (block.findChildrenOfType(ASTLiteral.class));
if (literal.size() == 0) {
if (literal.isEmpty()) {
List name = (block.findChildrenOfType(ASTName.class));
if (name.size() != 0) {
if (!name.isEmpty()) {
iConstructorLength = -1;
}
} else if (literal.size() == 1) {