mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
unrelated defaults: ignore type parameters check for abstract methods only, leave as is for defaults
This commit is contained in:
@@ -442,7 +442,6 @@ public class GenericsHighlightUtil {
|
||||
|
||||
static HighlightInfo checkUnrelatedDefaultMethods(@NotNull PsiClass aClass,
|
||||
@NotNull PsiIdentifier classIdentifier) {
|
||||
if (aClass instanceof PsiTypeParameter) return null;
|
||||
final Map<MethodSignature, Set<PsiMethod>> overrideEquivalent =
|
||||
new THashMap<MethodSignature, Set<PsiMethod>>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY);
|
||||
PsiClass[] supers = aClass.getSupers();
|
||||
@@ -501,7 +500,8 @@ public class GenericsHighlightUtil {
|
||||
final PsiMethod unrelatedMethod = astracts != null ? astracts.get(0) : defaults.get(1);
|
||||
final PsiClass unrelatedMethodContainingClass = unrelatedMethod.getContainingClass();
|
||||
if (unrelatedMethodContainingClass == null) continue;
|
||||
if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && astracts != null && unrelatedMethodContainingClass.isInterface()) {
|
||||
if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !(aClass instanceof PsiTypeParameter)
|
||||
&& astracts != null && unrelatedMethodContainingClass.isInterface()) {
|
||||
if (defaultMethodContainingClass.isInheritor(unrelatedMethodContainingClass, true) &&
|
||||
MethodSignatureUtil.isSubsignature(unrelatedMethod.getSignature(TypeConversionUtil.getSuperClassSubstitutor(unrelatedMethodContainingClass, defaultMethodContainingClass, PsiSubstitutor.EMPTY)),
|
||||
defaultMethod.getSignature(PsiSubstitutor.EMPTY))) {
|
||||
|
||||
@@ -7,8 +7,11 @@ interface B extends A {
|
||||
}
|
||||
interface C extends A {}
|
||||
interface D extends C {}
|
||||
|
||||
interface E {
|
||||
default void f() {}
|
||||
}
|
||||
class U {
|
||||
<T extends B & C> void m (){}
|
||||
<T extends B & D> void m1(){}
|
||||
<<error descr="T inherits abstract and default for f() from types E and B">T</error> extends B & E> void m2(){}
|
||||
}
|
||||
Reference in New Issue
Block a user