[java] InefficientStringBuffering: fix another ternary false positive
This commit is contained in:
@ -46,7 +46,7 @@ public class InefficientStringBufferingRule extends AbstractJavaRule {
|
||||
|
||||
@Override
|
||||
public Object visit(ASTAdditiveExpression node, Object data) {
|
||||
if (node.getParent() instanceof ASTConditionalExpression) {
|
||||
if (node.getParent() instanceof ASTConditionalExpression || node.getNthParent(2) instanceof ASTConditionalExpression) {
|
||||
// ignore concats in ternary expressions
|
||||
return data;
|
||||
}
|
||||
|
@ -447,6 +447,7 @@ public class Foo {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Foo{");
|
||||
sb.append("someInt=").append(this.someInt < 0 ? "n/a" : this.someInt + "ms");
|
||||
sb.append("someInt2=").append(this.someInt >= 0 ? this.someInt + "ms" : "n/a");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user