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.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index a950e432..6b1f8cb4 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
@@ -131,7 +132,10 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder {
}
}
- private fun skipElement(element: Any) = skipElementByVisibility(element) || hasSuppressDocTag(element)
+ 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 +143,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