mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
javadoc: process {@inheritDoc} for throws tags correctly (IDEA-62524)
This commit is contained in:
@@ -1297,8 +1297,8 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private void generateThrowsSection(StringBuilder buffer, PsiMethod method, final PsiDocComment comment) {
|
||||
PsiDocTag[] localTags = getThrowsTags(comment);
|
||||
private void generateThrowsSection(StringBuilder buffer, final PsiMethod method, final PsiDocComment comment) {
|
||||
final PsiDocTag[] localTags = getThrowsTags(comment);
|
||||
|
||||
LinkedList<Pair<PsiDocTag, InheritDocProvider<PsiDocTag>>> collectedTags =
|
||||
new LinkedList<Pair<PsiDocTag, InheritDocProvider<PsiDocTag>>>();
|
||||
@@ -1317,7 +1317,18 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
collectedTags.addFirst(new Pair<PsiDocTag, InheritDocProvider<PsiDocTag>>(localTags[i], ourEmptyProvider));
|
||||
final Pair<PsiDocTag, InheritDocProvider<PsiDocTag>> tag = findInheritDocTag(method, exceptionLocator(valueElement.getText()));
|
||||
collectedTags.addFirst(new Pair<PsiDocTag, InheritDocProvider<PsiDocTag>>(localTags[i], new InheritDocProvider<PsiDocTag>() {
|
||||
@Override
|
||||
public Pair<PsiDocTag, InheritDocProvider<PsiDocTag>> getInheritDoc() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClass getElement() {
|
||||
return method.getContainingClass();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows"><code>InheritedDocInThrows</code></a></b></small><PRE>void <b>foo</b>()
|
||||
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Overrides:</b><DD><a href="psi_element://A#foo()"><code>foo</code></a> in class <a href="psi_element://A"><code>A</code></a></DD></DL></DD><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - la-la-la</DD></DL></DD></body></html>
|
||||
@@ -0,0 +1,18 @@
|
||||
import java.io.IOException;
|
||||
|
||||
class InheritedDocInThrows extends A{
|
||||
/**
|
||||
* @throws IOException {@inheritDoc}
|
||||
*/
|
||||
void foo() throws IOException {
|
||||
super.foo();
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
/**
|
||||
* @throws IOException la-la-la
|
||||
*/
|
||||
void foo() throws IOException {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows1"><code>InheritedDocInThrows1</code></a></b></small><PRE>void <b>foo</b>()
|
||||
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Overrides:</b><DD><a href="psi_element://A#foo()"><code>foo</code></a> in class <a href="psi_element://A"><code>A</code></a></DD></DL></DD><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - comment</DD></DL></DD></body></html>
|
||||
@@ -0,0 +1,18 @@
|
||||
import java.io.IOException;
|
||||
|
||||
class InheritedDocInThrows1 extends A{
|
||||
/**
|
||||
* @throws java.io.IOException comment
|
||||
*/
|
||||
void foo() throws IOException {
|
||||
super.foo();
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
/**
|
||||
* @throws java.io.IOException la-la-la
|
||||
*/
|
||||
void foo() throws IOException {
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,14 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
public void testMethodTypeParameter() throws Exception {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
public void testInheritedDocInThrows() throws Exception {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
public void testInheritedDocInThrows1() throws Exception {
|
||||
doTestMethod();
|
||||
}
|
||||
|
||||
public void testClassTypeParameter() throws Exception {
|
||||
verifyJavaDoc(getTestClass());
|
||||
|
||||
Reference in New Issue
Block a user