FoldExpressionIntoStream: disable for non-string separator and automatically convert char

CharToStringIntention#stringForCharLiteral moved to PsiLiteralUtil
Fixes IDEA-195621 "Expression can be folded into Stream chain" produces red code when delimiter is char type
This commit is contained in:
Tagir Valeev
2018-07-29 13:41:30 +07:00
parent 0ee4ea1fad
commit 229f9206e8
6 changed files with 62 additions and 15 deletions
@@ -0,0 +1,7 @@
// "Fold expression into 'String.join'" "true"
class Test {
String foo(String a, String b, String c) {
String s = String.join("_", a, b, c);
return s;
}
}
@@ -0,0 +1,7 @@
// "Fold expression into 'String.join'" "true"
class Test {
String foo(String a, String b, String c) {
String s = a + <caret>'_' + b + '_' + c ;
return s;
}
}
@@ -0,0 +1,7 @@
// "Fold expression into 'String.join'" "false"
class Test {
String foo(String a, String b, String c) {
String s = a + <caret>5 + b + 5 + c ;
return s;
}
}