diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-03 21:30:01 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-03 21:53:40 +0300 |
commit | ce7ebd213a56abd2be6beacbef26b339935baeb6 (patch) | |
tree | c713fa20f21ab0b8c19f30dac3044b055ba84898 /core/src | |
parent | 487dba687ad0891eebe61433c83c9ad5bf529b7b (diff) | |
download | dokka-ce7ebd213a56abd2be6beacbef26b339935baeb6.tar.gz dokka-ce7ebd213a56abd2be6beacbef26b339935baeb6.tar.bz2 dokka-ce7ebd213a56abd2be6beacbef26b339935baeb6.zip |
Fix not suppressing Android generated files in javadoc format
fixes #224, fixes #197
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 9 |
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 |