diff --git a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java
index be7e79232328..b3e8a69d46d9 100644
--- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -120,6 +121,9 @@ public class RedundantArrayForVarargsCallInspection extends GenericsInspectionTo
if (initializers == null) {
return;
}
+ if (Arrays.stream(initializers).anyMatch(expr -> expr instanceof PsiArrayInitializerExpression)) {
+ return;
+ }
if (!isSafeToFlatten(expression, method, initializers)) {
return;
}
diff --git a/java/java-tests/testData/inspection/redundantArrayForVarargs/NestedArray.java b/java/java-tests/testData/inspection/redundantArrayForVarargs/NestedArray.java
index d91e1b0e6169..634b50e697f5 100644
--- a/java/java-tests/testData/inspection/redundantArrayForVarargs/NestedArray.java
+++ b/java/java-tests/testData/inspection/redundantArrayForVarargs/NestedArray.java
@@ -1,3 +1,5 @@
+import java.util.*;
+
public class NestedArray {
public NestedArray() {}
@@ -13,4 +15,22 @@ public class NestedArray {
method(new Object[]{"2", params});
method(new Object[]{params, params});
}
+
+ public static Collection quickFixErrorIDEA165068() {
+ return Arrays.asList(new String[][]{
+ {"bla", " bla"},
+ {"bla", " bla"},
+ {"bla", " bla"},
+ {"bla", " bla"},
+ });
+ }
+
+ public static Collection quickFixError2() {
+ return Arrays.asList(new String[][]{
+ new String[] {"bla", " bla"},
+ new String[] {"bla", " bla"},
+ new String[] {"bla", " bla"},
+ new String[] {"bla", " bla"},
+ });
+ }
}
\ No newline at end of file