mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
don't treat static method as concrete in hierarchy (IDEA-180930)
This commit is contained in:
@@ -461,7 +461,7 @@ public class GenericsHighlightUtil {
|
||||
if (abstracts == null) abstracts = new ArrayList<>(2);
|
||||
abstracts.add(method);
|
||||
}
|
||||
hasConcrete |= !isDefault && !isAbstract;
|
||||
hasConcrete |= !isDefault && !isAbstract && !method.hasModifierProperty(PsiModifier.STATIC);
|
||||
}
|
||||
|
||||
if (!hasConcrete && defaults != null) {
|
||||
@@ -469,7 +469,16 @@ public class GenericsHighlightUtil {
|
||||
if (MethodSignatureUtil.findMethodBySuperMethod(aClass, defaultMethod, false) != null) continue;
|
||||
final PsiClass defaultMethodContainingClass = defaultMethod.getContainingClass();
|
||||
if (defaultMethodContainingClass == null) continue;
|
||||
final PsiMethod unrelatedMethod = abstracts != null ? abstracts.get(0) : defaults.get(1);
|
||||
final PsiMethod unrelatedMethod;
|
||||
if (abstracts != null) {
|
||||
unrelatedMethod = abstracts.get(0);
|
||||
}
|
||||
else if (defaults.size() > 1) {
|
||||
unrelatedMethod = defaults.get(1);
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
final PsiClass unrelatedMethodContainingClass = unrelatedMethod.getContainingClass();
|
||||
if (unrelatedMethodContainingClass == null) continue;
|
||||
if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !(aClass instanceof PsiTypeParameter)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
interface A {
|
||||
default void m() { }
|
||||
}
|
||||
|
||||
interface B {
|
||||
static void m() { }
|
||||
}
|
||||
|
||||
interface C {
|
||||
void m();
|
||||
}
|
||||
|
||||
class <error descr="Class 'D' must either be declared abstract or implement abstract method 'm()' in 'C'">D</error> implements A, B, C { }
|
||||
@@ -128,6 +128,8 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStaticAbstractDefaultInOneHierarchy() { doTest(); }
|
||||
|
||||
public void testMethodHierarchyWithDeclaredTypeParameters() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user