diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 17:36:22 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 17:36:22 +0200 |
commit | b96aaa55185152489adfe6682d7aeececfaf12b4 (patch) | |
tree | 7e17b3d995097cda6ae76234edebcc64a9501fd3 /core/src/main/kotlin/Java | |
parent | af27102b662439b4f7ccdeaf2195c93ba533c7be (diff) | |
download | dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.tar.gz dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.tar.bz2 dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.zip |
Don't include internal members in generated javadoc. Resolves #75
Diffstat (limited to 'core/src/main/kotlin/Java')
-rw-r--r-- | core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt index d2748ee3..e73b19b4 100644 --- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt +++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt @@ -3,6 +3,10 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.intellij.psi.* import com.intellij.psi.util.InheritanceUtil +import org.jetbrains.kotlin.asJava.KtLightElement +import org.jetbrains.kotlin.lexer.KtModifierKeywordToken +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.KtModifierListOwner fun getSignature(element: PsiElement?) = when(element) { is PsiClass -> element.qualifiedName @@ -127,7 +131,14 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { private fun skipElementByVisibility(element: Any): Boolean = !options.includeNonPublic && element is PsiModifierListOwner && - (element.hasModifierProperty(PsiModifier.PRIVATE) || element.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) + (element.hasModifierProperty(PsiModifier.PRIVATE) || + element.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) || + element.isInternal()) + + private fun PsiElement.isInternal(): Boolean { + val ktElement = (this as? KtLightElement<*, *>)?.kotlinOrigin ?: return false + return (ktElement as? KtModifierListOwner)?.hasModifier(KtTokens.INTERNAL_KEYWORD) ?: false + } fun <T : Any> DocumentationNode.appendMembers(elements: Array<T>, buildFn: T.() -> DocumentationNode) = appendChildren(elements, RefKind.Member, buildFn) |