aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/JavaDocumentationBuilder.kt12
-rw-r--r--test/data/java/member.java1
-rw-r--r--test/src/model/JavaTest.kt8
3 files changed, 13 insertions, 8 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 660ffafb..c76c4c33 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -31,11 +31,11 @@ public class JavaDocumentationBuilder() {
val text = if (result.isEmpty()) it.getText().trimLeading() else it.getText()
result.append(ContentText(text))
}
- docComment.getTags().forEach {
- val subjectName = it.getSubjectName()
- val section = result.addSection(javadocSectionDisplayName(it.getName()), subjectName)
- it.getDataElements().forEach {
- if (it !is PsiDocTagValue) {
+ docComment.getTags().forEach { tag ->
+ val subjectName = tag.getSubjectName()
+ val section = result.addSection(javadocSectionDisplayName(tag.getName()), subjectName)
+ tag.getDataElements().forEach {
+ if (it !is PsiDocTagValue || tag.getSubjectName() == null) {
section.append(ContentText(it.getText()))
}
}
@@ -44,7 +44,7 @@ public class JavaDocumentationBuilder() {
}
fun PsiDocTag.getSubjectName(): String? {
- if (getName() == "param") {
+ if (getName() == "param" || getName() == "throws" || getName() == "exception") {
return getValueElement()?.getText()
}
return null
diff --git a/test/data/java/member.java b/test/data/java/member.java
index cf978444..a417ff7e 100644
--- a/test/data/java/member.java
+++ b/test/data/java/member.java
@@ -5,6 +5,7 @@ class Test {
* Summary for Function
* @param name is String parameter
* @param value is int parameter
+ * @author yole
*/
public void fn(String name, int value) {
diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt
index 2f67d7e8..fe4fd322 100644
--- a/test/src/model/JavaTest.kt
+++ b/test/src/model/JavaTest.kt
@@ -13,7 +13,7 @@ public class JavaTest {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Summary for Function", content.summary.toTestString())
- assertEquals(2, content.sections.size())
+ assertEquals(3, content.sections.size())
with(content.sections[0]) {
assertEquals("Parameters", tag)
assertEquals("name", subjectName)
@@ -22,7 +22,11 @@ public class JavaTest {
with(content.sections[1]) {
assertEquals("Parameters", tag)
assertEquals("value", subjectName)
- assertEquals("is int parameter", toTestString())
+ assertEquals("is int parameter ", toTestString())
+ }
+ with(content.sections[2]) {
+ assertEquals("Author", tag)
+ assertEquals("yole", toTestString())
}
assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())