forked from phoedos/pmd
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:
@ -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() });
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user