[java-postfix] IDEA-296188 Erroneous Arrays.stream completion in array field assignment

GitOrigin-RevId: b48d3b0ffaa8abd3e3676a6a02880ea5a691173b
This commit is contained in:
Tagir Valeev
2022-06-20 14:01:10 +00:00
committed by intellij-monorepo-bot
parent d4a5a88e61
commit ce005dce54
4 changed files with 24 additions and 0 deletions
@@ -27,6 +27,8 @@ public class StreamPostfixTemplate extends StringBasedPostfixTemplate {
private static final Condition<PsiElement> IS_SUPPORTED_ARRAY = element -> {
if (!(element instanceof PsiExpression)) return false;
if (element instanceof PsiAssignmentExpression && element.getParent() instanceof PsiExpressionStatement) return false;
PsiType type = ((PsiExpression)element).getType();
if (!(type instanceof PsiArrayType)) return false;
@@ -0,0 +1,9 @@
package templates;
public class Foo {
public static void main(String[] args) {
Object[] a;
Object o;
a = o.str<caret>
}
}
@@ -0,0 +1,9 @@
package templates;
public class Foo {
public static void main(String[] args) {
Object[] a;
Object o;
a = o.str <caret>
}
}
@@ -44,6 +44,10 @@ public class StreamPostfixTemplateTest extends PostfixTemplateTestCase {
doTest();
}
public void testAssignment() {
doTest();
}
public void testNotAvailable() {
doTest();
}