aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt7
-rw-r--r--core/src/main/kotlin/javadoc/docbase.kt4
-rw-r--r--core/src/test/kotlin/javadoc/JavadocTest.kt4
3 files changed, 6 insertions, 9 deletions
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index 39a4568a..d6e46c50 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -83,7 +83,7 @@ class JavadocParser(
"see" -> result.convertSeeTag(tag)
"deprecated" -> {
deprecatedContent = Content().apply {
- appendAll(convertJavadocElements(tag.contentElementsOrFirstChild(), element))
+ appendAll(convertJavadocElements(tag.contentElements(), element))
}
}
in tagsToInherit -> {}
@@ -122,10 +122,9 @@ class JavadocParser(
recursiveSearch(arrayOf(this))
return output.mapValues { it.value.values }
}
- private fun PsiDocTag.contentElementsOrFirstChild(): Collection<PsiElement> = contentElements()
- .takeIf { it.isNotEmpty() } ?: children.take(1)
- private fun PsiDocTag.contentElements(): Collection<PsiElement> {
+
+ private fun PsiDocTag.contentElements(): Iterable<PsiElement> {
val tagValueElements = children
.dropWhile { it.node?.elementType == JavaDocTokenType.DOC_TAG_NAME }
.dropWhile { it is PsiWhiteSpace }
diff --git a/core/src/main/kotlin/javadoc/docbase.kt b/core/src/main/kotlin/javadoc/docbase.kt
index fcc017fd..fbf8c464 100644
--- a/core/src/main/kotlin/javadoc/docbase.kt
+++ b/core/src/main/kotlin/javadoc/docbase.kt
@@ -75,9 +75,7 @@ open class DocumentationNodeAdapter(override val module: ModuleNodeAdapter, node
node.deprecation?.let {
val content = it.content.asText()
- if (content != null) {
- result.add(TagImpl(this, "deprecated", content))
- }
+ result.add(TagImpl(this, "deprecated", content ?: ""))
}
return result.toTypedArray()
diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt
index 7f1b44da..04f8b920 100644
--- a/core/src/test/kotlin/javadoc/JavadocTest.kt
+++ b/core/src/test/kotlin/javadoc/JavadocTest.kt
@@ -237,8 +237,8 @@ class JavadocTest {
verifyJavadoc("testdata/javadoc/deprecated.java") { doc ->
val classDoc = doc.classNamed("bar.Banana")!!
- classDoc.methods().forEach {
- assertNotNull((it as? DocumentationNodeAdapter)?.node?.deprecation)
+ classDoc.methods().forEach { method ->
+ assertTrue(method.tags().any { it.kind() == "deprecated" })
}
}
}