IDEA-224600 Order of Types in Method Hierarchy is not correct.

GitOrigin-RevId: e8f9ae4f9406f9ce513bd396cfc3078a2d7268f9
This commit is contained in:
Tagir Valeev
2019-10-11 06:02:29 +00:00
committed by intellij-monorepo-bot
parent b5044991da
commit e9e57efef9
5 changed files with 26 additions and 3 deletions
@@ -58,7 +58,7 @@ public final class MethodHierarchyTreeStructure extends HierarchyTreeStructure {
while (true) {
PsiMethod superMethod = ArrayUtil.getFirstElement(method.findSuperMethods());
if (superMethod == null || superClasses.contains(superMethod.getContainingClass())) break;
superClasses.addAll(findInheritanceChain(method.getContainingClass(), superMethod.getContainingClass()));
superClasses.addAll(0, findInheritanceChain(method.getContainingClass(), superMethod.getContainingClass()));
method = superMethod;
}
return superClasses;
@@ -1,6 +1,6 @@
<node text="C ()">
<node text="A ()">
<node text="B ()">
<node text="A ()">
<node text="C ()">
<node text="D ()" base="true"/>
</node>
</node>
@@ -0,0 +1,5 @@
<node text="A ()">
<node text="B ()">
<node text="C ()" base="true"/>
</node>
</node>
@@ -0,0 +1,14 @@
interface A {
public void foo();
}
class B implements A {
@Override
public void foo() {}
}
class C extends B {
@Override
public void foo() {
System.out.println("C.foo");
}
}
@@ -72,6 +72,10 @@ public class JavaMethodHierarchyTest extends HierarchyViewTestBase {
doTest("D", "foo", "X.java");
}
public void testExtendsImplementsChain() throws Exception {
doTest("C", "foo", "X.java");
}
private void doTest(final String classFqn, final String methodName, final String... fileNames) throws Exception {
doHierarchyTest(() -> {
final PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(classFqn, ProjectScope.getProjectScope(getProject()));