From bea8cec70957148b03bfc5ec995199503d7696ff Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 27 Apr 2017 16:49:35 +0200 Subject: [PATCH] IG: handle void expected type separately --- .../miscGenerics/RedundantArrayForVarargsCallInspection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0764b75a722d..be7e79232328 100644 --- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java @@ -160,8 +160,9 @@ public class RedundantArrayForVarargsCallInspection extends GenericsInspectionTo if (!resolveResult.isValidResult() || resolveResult.getElement() != oldRefMethod) { return false; } + if (callExpression.getParent() instanceof PsiExpressionStatement) return true; final ExpectedTypeInfo[] expectedTypes = ExpectedTypesProvider.getExpectedTypes((PsiCallExpression)callExpression, false); - if (expectedTypes.length == 0) return true; + if (expectedTypes.length == 0) return false; final PsiType expressionType = ((PsiCallExpression)copy).getType(); if (expressionType == null) return false; for (ExpectedTypeInfo expectedType : expectedTypes) {