aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Java
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-11-02 16:05:47 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-11-02 16:05:47 +0300
commit40e81322426a925f3fe88e867a8a0e9858847835 (patch)
tree49c7ce2f48eac28dddc226edee663bd9f081e516 /core/src/main/kotlin/Java
parent225a4993835b3c5c798e9cecd17cbb31da5d9ee8 (diff)
downloaddokka-40e81322426a925f3fe88e867a8a0e9858847835.tar.gz
dokka-40e81322426a925f3fe88e867a8a0e9858847835.tar.bz2
dokka-40e81322426a925f3fe88e867a8a0e9858847835.zip
Fix for GH #98 : Added tests, altered fix code for corner cases
Diffstat (limited to 'core/src/main/kotlin/Java')
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index e73b19b4..268315ef 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -3,9 +3,13 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.intellij.psi.*
import com.intellij.psi.util.InheritanceUtil
+import com.intellij.psi.util.PsiTreeUtil
+import org.jetbrains.kotlin.asJava.KtLightDeclaration
import org.jetbrains.kotlin.asJava.KtLightElement
-import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
+import org.jetbrains.kotlin.kdoc.parser.KDocKnownTag
+import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag
import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtModifierListOwner
fun getSignature(element: PsiElement?) = when(element) {
@@ -277,6 +281,8 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
}
}
-fun hasSuppressDocTag(element: Any?) =
- element is PsiDocCommentOwner && element.docComment?.let { it.findTagByName("suppress") != null } ?: false
+fun hasSuppressDocTag(element: Any?): Boolean {
+ val declaration = (element as? KtLightDeclaration<*, *>)?.kotlinOrigin as? KtDeclaration ?: return false
+ return PsiTreeUtil.findChildrenOfType(declaration.docComment, KDocTag::class.java).any { it.knownTag == KDocKnownTag.SUPPRESS }
+}