[java] fix change parameter class fix availability (IDEA-278909)

GitOrigin-RevId: 01ae90db563b7512c7ca1f7bd471ebd6f4c8f61f
This commit is contained in:
Anna Kozlova
2021-09-27 18:37:12 +02:00
committed by intellij-monorepo-bot
parent a8590ad89f
commit 07c9d4f8de
2 changed files with 13 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.ExceptionUtil;
@@ -1887,7 +1887,7 @@ public final class HighlightMethodUtil {
PsiClass expressionClass = PsiUtil.resolveClassInType(expressionType);
if (parameterClass == null || expressionClass == null) continue;
if (expressionClass instanceof PsiAnonymousClass) continue;
if (parameterClass.isInheritor(expressionClass, true)) continue;
if (expressionClass.isInheritor(parameterClass, true)) continue;
QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createChangeParameterClassFix(expressionClass, (PsiClassType)parameterType));
}
}

View File

@@ -0,0 +1,11 @@
// "Make 'a' implement 'b'" "false"
class a<T> implements b<T> {
}
interface b<T> { }
class f {
<K> void g(b<K> kb, java.util.List<K> l) {}
void m(a<String> aa){
g(a<caret>a, new Object());
}
}