mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-380337 javadoc: Fix broken rendered jdoc
This commit also fixes broken links in nested classes GitOrigin-RevId: 44443df5abd7646168124452ad25679e6570166d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d49c348c01
commit
f0714e9407
@@ -115,12 +115,15 @@ public final class JavaDocUtil {
|
||||
PsiClass aClass = classRef.isEmpty()
|
||||
? PsiTreeUtil.getParentOfType(context, PsiClass.class, false)
|
||||
: findClassFromRef(manager, facade, classRef, context);
|
||||
if (aClass == null) return null;
|
||||
if (fragmentIndex >= 0) {
|
||||
return findFragmentOwner(aClass, useNavigationElement, refTextCorrected, fragmentIndex, manager);
|
||||
} else {
|
||||
return findReference(aClass, useNavigationElement, refTextCorrected, poundIndex);
|
||||
while (aClass != null){
|
||||
PsiElement reference = fragmentIndex >= 0
|
||||
? findFragmentOwner(aClass, useNavigationElement, refTextCorrected, fragmentIndex, manager)
|
||||
: findReference(aClass, context, useNavigationElement, refTextCorrected, poundIndex);
|
||||
if (reference != null) return reference;
|
||||
|
||||
aClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,10 +144,11 @@ public final class JavaDocUtil {
|
||||
}
|
||||
|
||||
private static @Nullable PsiElement findReference(@NotNull PsiClass refClass,
|
||||
PsiElement context,
|
||||
boolean useNavigationElement,
|
||||
String refTextCorrected,
|
||||
int poundIndex) {
|
||||
PsiElement member = findReferencedMember(refClass, refTextCorrected.substring(poundIndex + 1), refClass);
|
||||
PsiElement member = findReferencedMember(refClass, refTextCorrected.substring(poundIndex + 1), context);
|
||||
return useNavigationElement && member != null ? member.getNavigationElement() : member;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><head><base href="placeholder"></head><body><div class="bottom"><icon src="AllIcons.Nodes.Class"> <a href="psi_element://Outside.Inside"><code><span style="color:#000000;">Outside.Inside</span></code></a></div><div class='definition'><pre><span style="color:#000080;font-weight:bold;">void</span> <span style="color:#000000;">inside</span><span style="">(</span><span style="">)</span></pre></div><div class='content'><a href="psi_element://Outside#outside()"><code><span style="color:#0000ff;">outside</span><span style="">()</span></code></a></div><table class='sections'></table>
|
||||
@@ -0,0 +1,8 @@
|
||||
class Outside {
|
||||
void outside(){}
|
||||
|
||||
class Inside {
|
||||
/// [#outside()]
|
||||
void inside(){}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<html><head><base href="placeholder"></head><body><div class='definition'><pre><span style="color:#000080;font-weight:bold;">class</span> <span style="color:#000000;">MarkdownCodeBlock</span></pre></div><div class='content'><p><a href="psi_element://java.util.HashMap"><code><span style="color:#0000ff;">java.util.HashMap</span></code></a></p><p><a href="psi_element://java.util.Collections#EMPTY_LIST">The default empty collection</a></p></div><table class='sections'><p></table>
|
||||
<html><head><base href="placeholder"></head><body><div class='definition'><pre><span style="color:#000080;font-weight:bold;">class</span> <span style="color:#000000;">MarkdownCodeBlock</span></pre></div><div class='content'><p><a href="psi_element://java.util.HashMap"><code><span style="color:#0000ff;">java.util.HashMap</span></code></a></p><p><a href="psi_element://java.util.Collections#EMPTY_LIST">The default empty collection</a></p><p><a href="psi_element://java.util.Collection#add(java.lang.Object)">Test for context resolution</a></p></div><table class='sections'><p></table>
|
||||
@@ -3,4 +3,6 @@
|
||||
/// [java.util.HashMap]
|
||||
///
|
||||
/// [The default empty collection][java.util.Collections#EMPTY_LIST]
|
||||
///
|
||||
/// [Test for context resolution][java.util.Collection#add(Object)]
|
||||
class MarkdownCodeBlock {}
|
||||
+4
@@ -125,6 +125,10 @@ public class JavaDocInfoGeneratorTest extends JavaCodeInsightTestCase {
|
||||
public void testLegacySpacesInLiteral() { useJava7(); verifyJavaDoc(getTestClass()); }
|
||||
public void testLinkWithModule() { doTestClass(); }
|
||||
public void testLinkToModule() { doTestClass(); }
|
||||
public void testLinkNested() {
|
||||
configureByFile();
|
||||
verifyJavaDoc(getTestClass().getAllInnerClasses()[0].getMethods()[0]);
|
||||
}
|
||||
public void testLinkWithLineBreak() { doTestClass(); }
|
||||
public void testDocumentationForJdkClassWithReferencesToClassesFromJavaLang() { useJava7(); doTestAtCaret(); }
|
||||
public void testDocumentationForUncheckedExceptionsInSupers() { useJava7(); doTestAtCaret(); }
|
||||
|
||||
Reference in New Issue
Block a user