java: hide method return type fix when compilation error won't be fixed (IDEA-244902)

GitOrigin-RevId: 8617da7628ec1ca24f66305b10573e331aa2c031
This commit is contained in:
Anna Kozlova
2020-07-01 08:27:38 +00:00
committed by intellij-monorepo-bot
parent 3335afcf68
commit fab2f3b722
3 changed files with 2 additions and 10 deletions
@@ -678,7 +678,7 @@ public final class HighlightMethodUtil {
private static void registerMethodReturnFixAction(@NotNull HighlightInfo highlightInfo,
@NotNull MethodCandidateInfo candidate,
@NotNull PsiCall methodCall) {
if (methodCall.getParent() instanceof PsiReturnStatement) {
if (candidate.getInferenceErrorMessage() != null && methodCall.getParent() instanceof PsiReturnStatement) {
final PsiMethod containerMethod = PsiTreeUtil.getParentOfType(methodCall, PsiMethod.class, true, PsiLambdaExpression.class);
if (containerMethod != null) {
final PsiMethod method = candidate.getElement();
@@ -1,8 +0,0 @@
// "Make 'bar' return 'Foo'" "true"
public class Foo {
public Foo(int i) {}
Foo bar() {
return new Foo("");
}
}
@@ -1,4 +1,4 @@
// "Make 'bar' return 'Foo'" "true"
// "Make 'bar' return 'Foo'" "false"
public class Foo {
public Foo(int i) {}