mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
ChangeToAppendUtil: do not add useless .append("")
Partially fixes IDEA-180178 String concatenation as argument to 'StringBuilder.append()' call should be smarter
This commit is contained in:
@@ -56,7 +56,7 @@ public class ChangeToAppendUtil {
|
||||
}
|
||||
builder.append(CommentTracker.textWithSurroundingComments(operand));
|
||||
}
|
||||
else {
|
||||
else if (!operand.textMatches("\"\"")) {
|
||||
isConstant = false;
|
||||
if (builder.length() != 0) {
|
||||
append(builder, useStringValueOf && !isString, out);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Convert variable 'res' from String to StringBuilder" "true"
|
||||
|
||||
public class Main {
|
||||
String test(int[] ints) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (int i : ints) {
|
||||
res.append(i);
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Convert variable 'res' from String to StringBuilder" "true"
|
||||
|
||||
public class Main {
|
||||
String test(int[] ints) {
|
||||
String res = "";
|
||||
for (int i : ints) {
|
||||
res = res <caret>+ i + "";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user