Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/stringConcatInLoop/beforeConcatNullSafe3.java
Tagir Valeev 2e7492686e StringConcatenationInLoopsInspection: null-safe fixes
Fixes IDEA-183139 "String to StringBuilder" quick fix may cause NPE
2017-12-26 17:18:40 +07:00

14 lines
343 B
Java

// "Convert variable 'res' from String to StringBuilder (null-safe)" "true"
public class Main {
String test(String[] strings) {
String res = null;
res += "foo";
for (String s : strings) {
res+<caret>=", ";
res+=s;
}
return res; // known to be not-null at this point
}
}