mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 05:51:25 +07:00
unrelated defaults when one interface overrides 2 unrelated (IDEA-163469)
This commit is contained in:
@@ -512,14 +512,14 @@ public class GenericsHighlightUtil {
|
||||
|
||||
private static String hasUnrelatedDefaults(List<PsiClass> defaults) {
|
||||
if (defaults.size() > 1) {
|
||||
for (int i = 0; i < defaults.size(); i++) {
|
||||
final PsiClass aClass1 = defaults.get(i);
|
||||
for (int j = i + 1; j < defaults.size(); j++) {
|
||||
final PsiClass aClass2 = defaults.get(j);
|
||||
if (aClass2 != null && !belongToOneHierarchy(aClass1, aClass2)) {
|
||||
return HighlightUtil.formatClass(aClass1) + " and " + HighlightUtil.formatClass(aClass2);
|
||||
}
|
||||
}
|
||||
PsiClass[] defaultClasses = defaults.toArray(PsiClass.EMPTY_ARRAY);
|
||||
ArrayList<PsiClass> classes = new ArrayList<>(defaults);
|
||||
for (final PsiClass aClass1 : defaultClasses) {
|
||||
classes.removeIf(aClass2 -> aClass1.isInheritor(aClass2, true));
|
||||
}
|
||||
|
||||
if (classes.size() > 1) {
|
||||
return HighlightUtil.formatClass(classes.get(0)) + " and " + HighlightUtil.formatClass(classes.get(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
interface OraModMajorObject extends OraMajorObject {}
|
||||
interface OraModStoredSchemaObject extends OraStoredSchemaObject {}
|
||||
interface OraModCluster extends OraCluster, OraModMajorObject, OraModStoredSchemaObject {}
|
||||
|
||||
interface OraStoredSchemaObject {
|
||||
default boolean isNameSurrogate() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
interface OraMajorObject {
|
||||
default boolean isNameSurrogate() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
interface OraCluster extends OraMajorObject, OraStoredSchemaObject {
|
||||
default boolean isNameSurrogate() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,6 +67,10 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testUnrelatedDefaultsWhenOneInterfaceOverrides2Unrelated() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testStaticMethodAccessibleBothThroughStaticImportAndInheritance() throws Exception {
|
||||
myFixture.addClass("package p; public interface Foo {" +
|
||||
" static void foo() {}" +
|
||||
|
||||
Reference in New Issue
Block a user