diff options
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 12 | ||||
-rw-r--r-- | core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt | 9 |
2 files changed, 14 insertions, 7 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 } +} diff --git a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt index ddfa6621..304b2bf2 100644 --- a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt @@ -37,10 +37,11 @@ class KotlinAsJavaDocumentationBuilder } } - fun PsiClass.isVisibleInDocumentation() : Boolean { - val origin: KtDeclaration? = (this as KtLightElement<*, *>).kotlinOrigin as? KtDeclaration - return origin?.hasModifier(KtTokens.INTERNAL_KEYWORD) != true && - origin?.hasModifier(KtTokens.PRIVATE_KEYWORD) != true + fun PsiClass.isVisibleInDocumentation(): Boolean { + val origin: KtDeclaration = (this as KtLightElement<*, *>).kotlinOrigin as? KtDeclaration ?: return true + + return origin.hasModifier(KtTokens.INTERNAL_KEYWORD) != true && + origin.hasModifier(KtTokens.PRIVATE_KEYWORD) != true } } |