mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-143911 (quick fix produces uncompilable code (StringBuffer can be replaced with String))
This commit is contained in:
+1
-1
@@ -209,7 +209,7 @@ public class StringBufferReplaceableByStringInspection extends BaseInspection {
|
||||
}
|
||||
|
||||
if (element instanceof PsiWhiteSpace) {
|
||||
if (element.getText().contains("\n")) {
|
||||
if (element.getText().contains("\n") && result.length() > 0) {
|
||||
result.append('\n'); // keep line break structure
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Linebreaks {
|
||||
|
||||
void m(String code) {
|
||||
String controlDigit = String.valueOf(code.charAt(5)) +
|
||||
code.charAt(7) +
|
||||
code.charAt(9) +
|
||||
code.charAt(11);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Linebreaks {
|
||||
|
||||
void m(String code) {
|
||||
String controlDigit = new Stri<caret>ngBuilder()
|
||||
.append(code.charAt(5))
|
||||
.append(code.charAt(7))
|
||||
.append(code.charAt(9))
|
||||
.append(code.charAt(11)).toString();
|
||||
}
|
||||
}
|
||||
+1
@@ -35,4 +35,5 @@ public class StringBufferReplaceableByStringFixTest extends IGQuickFixesTestCase
|
||||
public void testMethodCallOnString() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testComplex1() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testComplex2() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testLinebreaks() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user