previous commit was a little too aggressive
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6423 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
8f4f95ddff
commit
51bdf6faf4
1 file changed
+5
-2
+5
-2
@@ -40,11 +40,14 @@ public class InefficientStringBufferingRule extends AbstractJavaRule {
|
||||
int immediateLiterals = 0;
|
||||
List<ASTLiteral> nodes = node.findDescendantsOfType(ASTLiteral.class);
|
||||
for (ASTLiteral literal: nodes) {
|
||||
if (literal.getNthParent(3) == node) {
|
||||
if (literal.getNthParent(3) instanceof ASTAdditiveExpression) {
|
||||
immediateLiterals++;
|
||||
}
|
||||
if (!literal.isStringLiteral()) {
|
||||
try {
|
||||
Integer.parseInt(literal.getImage());
|
||||
return data;
|
||||
} catch (NumberFormatException nfe) {
|
||||
// NFE means new StringBuffer("a" + "b"), want to flag those
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user