diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2016-11-02 15:11:18 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2016-11-02 15:11:18 +0300 |
commit | 225a4993835b3c5c798e9cecd17cbb31da5d9ee8 (patch) | |
tree | 76d988c3172257c4ddcf796b621b88dbf5e9dff2 /core/src | |
parent | 7922e2a940f91b587c70dfb3d41e0048bc93a19e (diff) | |
download | dokka-225a4993835b3c5c798e9cecd17cbb31da5d9ee8.tar.gz dokka-225a4993835b3c5c798e9cecd17cbb31da5d9ee8.tar.bz2 dokka-225a4993835b3c5c798e9cecd17cbb31da5d9ee8.zip |
Fix for GH #98 : Classes marked with `@suppress` are included in JavaDoc output
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt index ddfa6621..1250f463 100644 --- a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt @@ -4,9 +4,12 @@ import com.google.inject.Inject import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass import com.intellij.psi.PsiNamedElement +import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser import org.jetbrains.kotlin.asJava.KtLightElement import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +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.name.FqName import org.jetbrains.kotlin.psi.KtDeclaration @@ -37,10 +40,15 @@ class KotlinAsJavaDocumentationBuilder } } + fun KtDeclaration.isNotSuppressed() = + PsiTreeUtil.findChildrenOfType(this.docComment, KDocTag::class.java).none { it.knownTag == KDocKnownTag.SUPPRESS } + 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 + val origin: KtDeclaration = (this as KtLightElement<*, *>).kotlinOrigin as? KtDeclaration ?: return true + + return origin.isNotSuppressed() && + origin.hasModifier(KtTokens.INTERNAL_KEYWORD) != true && + origin.hasModifier(KtTokens.PRIVATE_KEYWORD) != true } } |