From b96aaa55185152489adfe6682d7aeececfaf12b4 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 30 Jun 2016 17:36:22 +0200 Subject: Don't include internal members in generated javadoc. Resolves #75 --- core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt') 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 DocumentationNode.appendMembers(elements: Array, buildFn: T.() -> DocumentationNode) = appendChildren(elements, RefKind.Member, buildFn) -- cgit