StringConcatenationInLoopsInspectionFix: fixed parenthesized append (IDEA-165968), fix renamed to "Convert variable ''{0}'' from String to {1}"

This commit is contained in:
Tagir Valeev
2016-12-28 13:40:03 +07:00
parent 69c86b0b45
commit 2c57d04054
14 changed files with 15 additions and 15 deletions
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
void test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
void test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -1,4 +1,4 @@
// "Change type of 'res' to StringBuilder" "true"
// "Convert variable 'res' from String to StringBuilder" "true"
public class Main {
String test(String[] strings) {
@@ -7,7 +7,7 @@ public class Main {
if (/*before*/!res/*within*/.isEmpty()) {
res += ", ";
}
res <caret>+= s;
res = (res <caret>+ s);
}
return res;
}
@@ -2203,4 +2203,4 @@ junit5.converter.fix.name=Migrate to JUnit 5
call.to.suspicious.string.method.display.name=Call to suspicious String method
call.to.suspicious.string.method.problem.descriptor=<code>String.#ref()</code> called in internationalized context #loc
string.concatenation.replace.fix=Replace with StringBuilder
string.concatenation.replace.fix.name=Change type of ''{0}'' to {1}
string.concatenation.replace.fix.name=Convert variable ''{0}'' from String to {1}
@@ -423,7 +423,7 @@ public class StringConcatenationInLoopsInspection extends BaseInspection {
List<PsiElement> results,
PsiAssignmentExpression assignment,
CommentTracker ct) {
PsiExpression rValue = assignment.getRExpression();
PsiExpression rValue = PsiUtil.skipParenthesizedExprDown(assignment.getRExpression());
if(assignment.getOperationTokenType().equals(JavaTokenType.EQ)) {
if (rValue instanceof PsiPolyadicExpression &&
((PsiPolyadicExpression)rValue).getOperationTokenType().equals(JavaTokenType.PLUS)) {