mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
[java-inspections] StringConcatenationInLoops: the quick-fix produces incorrect result
IDEA-306289 GitOrigin-RevId: 89cc6c4a394107e2c9eb8995915f28583a607231
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a1c599bdce
commit
7e0d6a7f1a
@@ -0,0 +1,20 @@
|
||||
// "Fix all 'String concatenation in loop' problems in file" "true"
|
||||
|
||||
public class Main {
|
||||
void test(String[] strings) {
|
||||
StringBuilder result1 = new StringBuilder();
|
||||
StringBuilder result2 = new StringBuilder();
|
||||
StringBuilder result3 = new StringBuilder();
|
||||
StringBuilder result4 = new StringBuilder();
|
||||
StringBuilder result5 = new StringBuilder();
|
||||
StringBuilder result6 = new StringBuilder();
|
||||
for (Integer i = 0; i < strings.length; i++) {
|
||||
result1.append(i + 1).append(" item: ").append(strings[i]).append(" ");
|
||||
result2.append(1 + i).append(" item: ").append(strings[i]).append(" ");
|
||||
result3.append(i).append(" item: ").append(1).append(strings[i]).append(" ");
|
||||
result4.append(" item: ").append(i).append(1).append(strings[i]).append(" ");
|
||||
result5.append(" item: " + 1).append(i).append(strings[i]).append(" ");
|
||||
result6.append(1 + " item: ").append(i).append(strings[i]).append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Fix all 'String concatenation in loop' problems in file" "true"
|
||||
|
||||
public class Main {
|
||||
void test(String[] strings) {
|
||||
StringBuilder result1 = new StringBuilder();
|
||||
StringBuilder result2 = new StringBuilder();
|
||||
StringBuilder result3 = new StringBuilder();
|
||||
StringBuilder result4 = new StringBuilder();
|
||||
StringBuilder result5 = new StringBuilder();
|
||||
StringBuilder result6 = new StringBuilder();
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
result1.append(i + 1).append(" item: ").append(strings[i]).append(" ");
|
||||
result2.append(1 + i).append(" item: ").append(strings[i]).append(" ");
|
||||
result3.append(i).append(" item: ").append(1).append(strings[i]).append(" ");
|
||||
result4.append(" item: ").append(i).append(1).append(strings[i]).append(" ");
|
||||
result5.append(" item: " + 1).append(i).append(strings[i]).append(" ");
|
||||
result6.append(1 + " item: ").append(i).append(strings[i]).append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Fix all 'String concatenation in loop' problems in file" "true"
|
||||
|
||||
public class Main {
|
||||
void test(String[] strings) {
|
||||
String result1 = "";
|
||||
String result2 = "";
|
||||
String result3 = "";
|
||||
String result4 = "";
|
||||
String result5 = "";
|
||||
String result6 = "";
|
||||
for (Integer i = 0; i < strings.length; i++) {
|
||||
result1 +=<caret> i + 1 + " item: " + strings[i] + " ";
|
||||
result2 += 1 + i + " item: " + strings[i] + " ";
|
||||
result3 += i + " item: " + 1 + strings[i] + " ";
|
||||
result4 += " item: " + i + 1 + strings[i] + " ";
|
||||
result5 += " item: " + 1 + i + strings[i] + " ";
|
||||
result6 += 1 + " item: " + i + strings[i] + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Fix all 'String concatenation in loop' problems in file" "true"
|
||||
|
||||
public class Main {
|
||||
void test(String[] strings) {
|
||||
String result1 = "";
|
||||
String result2 = "";
|
||||
String result3 = "";
|
||||
String result4 = "";
|
||||
String result5 = "";
|
||||
String result6 = "";
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
result1 +=<caret> i + 1 + " item: " + strings[i] + " ";
|
||||
result2 += 1 + i + " item: " + strings[i] + " ";
|
||||
result3 += i + " item: " + 1 + strings[i] + " ";
|
||||
result4 += " item: " + i + 1 + strings[i] + " ";
|
||||
result5 += " item: " + 1 + i + strings[i] + " ";
|
||||
result6 += 1 + " item: " + i + strings[i] + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user