aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt')
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index a950e432..cf2b0514 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -11,6 +11,7 @@ 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
+import java.io.File
fun getSignature(element: PsiElement?) = when(element) {
is PsiClass -> element.qualifiedName
@@ -57,7 +58,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
}
override fun appendFile(file: PsiJavaFile, module: DocumentationModule, packageContent: Map<String, Content>) {
- if (file.classes.all { skipElement(it) }) {
+ if (skipFile(file) || file.classes.all { skipElement(it) }) {
return
}
val packageNode = module.findOrCreatePackageNode(file.packageName, emptyMap(), refGraph)
@@ -131,7 +132,12 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
}
}
- private fun skipElement(element: Any) = skipElementByVisibility(element) || hasSuppressDocTag(element)
+ private fun skipFile(javaFile: PsiJavaFile): Boolean = options.effectivePackageOptions(javaFile.packageName).suppress
+
+ private fun skipElement(element: Any) =
+ skipElementByVisibility(element) ||
+ hasSuppressDocTag(element) ||
+ skipElementBySuppressedFiles(element)
private fun skipElementByVisibility(element: Any): Boolean = element is PsiModifierListOwner &&
!(options.effectivePackageOptions((element.containingFile as? PsiJavaFile)?.packageName ?: "").includeNonPublic) &&
@@ -139,6 +145,9 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
element.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) ||
element.isInternal())
+ private fun skipElementBySuppressedFiles(element: Any): Boolean =
+ element is PsiElement && File(element.containingFile.virtualFile.path).absoluteFile in options.suppressedFiles
+
private fun PsiElement.isInternal(): Boolean {
val ktElement = (this as? KtLightElement<*, *>)?.kotlinOrigin ?: return false
return (ktElement as? KtModifierListOwner)?.hasModifier(KtTokens.INTERNAL_KEYWORD) ?: false