From c3a779de1b9225e3017a06b2bd49eb2a6c4cec1e Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Mon, 5 Dec 2016 19:20:08 +0300 Subject: [PATCH] CollectionAddAllCanBeReplacedWithConstructorInspection: replace log assertions with conditional if statements (EA-92609) --- ...ctionAddAllCanBeReplacedWithConstructorInspection.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java b/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java index b5bd14915bf5..941b3a5a5fc2 100644 --- a/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java @@ -247,14 +247,12 @@ public class CollectionAddAllCanBeReplacedWithConstructorInspection extends Base @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiMethodCallExpression methodCallExpression = myMethodCallExpression.getElement(); - - LOG.assertTrue(methodCallExpression != null); - + if (methodCallExpression == null) return; final PsiElement parameter = methodCallExpression.getArgumentList().getExpressions()[0].copy(); final PsiNewExpression element = myAssignmentExpression.getElement(); - LOG.assertTrue(element != null); + if (element == null) return; final PsiExpressionList constructorArguments = element.getArgumentList(); - LOG.assertTrue(constructorArguments != null); + if (constructorArguments == null) return; constructorArguments.add(parameter); methodCallExpression.delete(); }