mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 07:20:53 +07:00
25 lines
639 B
Java
25 lines
639 B
Java
// "Convert variable 'res' from String to StringBuilder (null-safe)" "true-preview"
|
|
|
|
public class Main {
|
|
String test(String[] strings) {
|
|
String res = null;
|
|
for (String s : strings) {
|
|
if(res == null) {
|
|
res = s.isEmpty() ? null : s;
|
|
} else {
|
|
res<caret>+=", "+s;
|
|
}
|
|
res+=", ";
|
|
res+=s;
|
|
}
|
|
System.out.println(res);
|
|
consume(res);
|
|
return res; // known to be not-null at this point
|
|
}
|
|
|
|
// NotNull parameter inferred
|
|
static void consume(String s) {
|
|
System.out.println(s.trim());
|
|
}
|
|
}
|