aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/JavaDocumentationBuilder.kt13
-rw-r--r--src/Kotlin/DocumentationBuilder.kt8
2 files changed, 16 insertions, 5 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 6c83fd61..6624037c 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -11,6 +11,9 @@ import org.jsoup.nodes.TextNode
public class JavaDocumentationBuilder(private val options: DocumentationOptions,
private val refGraph: NodeReferenceGraph) {
fun appendFile(file: PsiJavaFile, module: DocumentationModule) {
+ if (file.getClasses().all { skipElement(it) }) {
+ return
+ }
val packageNode = module.findOrCreatePackageNode(file.getPackageName())
packageNode.appendChildren(file.getClasses()) { build() }
}
@@ -236,8 +239,14 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
}
}
- private fun skipElement(element: Any): Boolean =
- !options.includeNonPublic && element is PsiModifierListOwner && element.hasModifierProperty(PsiModifier.PRIVATE)
+ private fun skipElement(element: Any) = skipElementByVisibility(element) || hasSuppressTag(element)
+
+ private fun skipElementByVisibility(element: Any): Boolean =
+ !options.includeNonPublic && element is PsiModifierListOwner &&
+ (element.hasModifierProperty(PsiModifier.PRIVATE) || element.hasModifierProperty(PsiModifier.PACKAGE_LOCAL))
+
+ private fun hasSuppressTag(element: Any) =
+ element is PsiDocCommentOwner && element.getDocComment()?.let { it.findTagByName("suppress") != null } ?: false
fun DocumentationNode.appendMembers<T>(elements: Array<T>, buildFn: T.() -> DocumentationNode) =
appendChildren(elements, DocumentationReference.Kind.Member, buildFn)
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index c31c3735..18a1e74c 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -41,7 +41,7 @@ class DocumentationBuilder(val session: ResolveSession,
val options: DocumentationOptions,
val refGraph: NodeReferenceGraph,
val logger: DokkaLogger) {
- val visibleToDocumentation = setOf(Visibilities.INTERNAL, Visibilities.PROTECTED, Visibilities.PUBLIC)
+ val visibleToDocumentation = setOf(Visibilities.PROTECTED, Visibilities.PUBLIC)
val boringBuiltinClasses = setOf(
"kotlin.Unit", "kotlin.Byte", "kotlin.Short", "kotlin.Int", "kotlin.Long", "kotlin.Char", "kotlin.Boolean",
"kotlin.Float", "kotlin.Double", "kotlin.String", "kotlin.Array", "kotlin.Any")
@@ -395,8 +395,10 @@ class DocumentationBuilder(val session: ResolveSession,
val packageNode = findOrCreatePackageNode(packageName)
val externalClassNodes = hashMapOf<FqName, DocumentationNode>()
declarations.forEach { descriptor ->
- val parent = packageNode.getParentForPackageMember(descriptor, externalClassNodes)
- parent.appendChild(descriptor, DocumentationReference.Kind.Member)
+ if (descriptor.isDocumented()) {
+ val parent = packageNode.getParentForPackageMember(descriptor, externalClassNodes)
+ parent.appendChild(descriptor, DocumentationReference.Kind.Member)
+ }
}
}
}