From 1126e85c51d63c6ae01df0c007e722db0c4de513 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Fri, 22 Apr 2016 16:22:26 +0200 Subject: [PATCH] EA-76035 - PIEAE: PsiUtilCore.ensureValid --- .../impl/quickfix/MethodReturnTypeFix.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java index 2848899bab90..308ffa30cef1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java @@ -40,7 +40,6 @@ import com.intellij.psi.util.TypeConversionUtil; import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor; import com.intellij.refactoring.changeSignature.OverriderUsageInfo; import com.intellij.refactoring.changeSignature.ParameterInfoImpl; -import com.intellij.refactoring.typeMigration.TypeMigrationLabeler; import com.intellij.refactoring.typeMigration.TypeMigrationProcessor; import com.intellij.refactoring.typeMigration.TypeMigrationRules; import com.intellij.usageView.UsageInfo; @@ -89,14 +88,16 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle @NotNull PsiElement endElement) { final PsiMethod myMethod = (PsiMethod)startElement; - PsiType myReturnType = myReturnTypePointer.getType(); - return myMethod.isValid() - && myMethod.getManager().isInProject(myMethod) - && myReturnType != null - && myReturnType.isValid() - && !TypeConversionUtil.isNullType(myReturnType) - && myMethod.getReturnType() != null - && !Comparing.equal(myReturnType, myMethod.getReturnType()); + final PsiType myReturnType = myReturnTypePointer.getType(); + if (myMethod.isValid() && + myMethod.getManager().isInProject(myMethod) && + myReturnType != null && + myReturnType.isValid() && + !TypeConversionUtil.isNullType(myReturnType)) { + final PsiType returnType = myMethod.getReturnType(); + if (returnType != null && returnType.isValid() && !Comparing.equal(myReturnType, returnType)) return true; + } + return false; } @Override