mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[javadoc] perform automatic supertype search recursively for interfaces
#IDEA-358073 GitOrigin-RevId: efeda57e732374963dd97dbe32c8fc1d938c5916
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e3bfab783
commit
e2f88c73c2
@@ -468,18 +468,19 @@ public final class JavaPsiImplementationHelperImpl extends JavaPsiImplementation
|
||||
// Check interfaces
|
||||
var targetInInterface = Stream.concat(Stream.of(psiClass.getImplementsListTypes()), Stream.of(psiClass.getExtendsListTypes()))
|
||||
.map(type -> type.resolve())
|
||||
.map(resolvedType -> findTarget(resolvedType, method, docTag, explicitSuper))
|
||||
.filter(Objects::nonNull)
|
||||
.map(resolvedType -> findTargetRecursively(resolvedType, method, docTag, explicitSuper, true, visitedSet))
|
||||
.filter(Objects::nonNull)
|
||||
.findFirst();
|
||||
|
||||
return targetInInterface.orElse(null);
|
||||
}
|
||||
|
||||
private static @Nullable PsiElement findTarget(@Nullable PsiClass psiClass,
|
||||
private static @Nullable PsiElement findTarget(@NotNull PsiClass psiClass,
|
||||
@NotNull PsiMethod method,
|
||||
@Nullable PsiDocTag docTag,
|
||||
@Nullable String explicitSuper) {
|
||||
if (psiClass == null || explicitSuper != null && !explicitSuper.equals(psiClass.getName())) {
|
||||
if (explicitSuper != null && !explicitSuper.equals(psiClass.getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,27 @@ public class JavaInheritDocNavigationTest extends LightJavaCodeInsightFixtureTes
|
||||
navigateAndCheckLine(1, "* B doc");
|
||||
}
|
||||
|
||||
public void test_inherit_doc_interface() {
|
||||
myFixture.configureByText("a.java", """
|
||||
interface A {
|
||||
/** A doc */
|
||||
void foo() {};
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
/** B doc */
|
||||
@Override void foo() {};
|
||||
}
|
||||
|
||||
interface C extends B {
|
||||
/** {@inherit<caret>Doc A} */
|
||||
@Override void foo() {};
|
||||
}
|
||||
""");
|
||||
|
||||
navigateAndCheckLine(0, "/** A doc */");
|
||||
}
|
||||
|
||||
public void test_inherit_doc_explicit_super() {
|
||||
myFixture.configureByText("a.java", """
|
||||
class A {
|
||||
|
||||
Reference in New Issue
Block a user