diff options
author | Ember Rose <emberrose@google.com> | 2022-01-27 05:27:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 13:27:02 +0300 |
commit | 066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb (patch) | |
tree | baedea544726c3ce703096c511228be91d764191 /plugins/base/src/main/kotlin/translators | |
parent | e0a10c24ea7e623137f2ab21522ed0f84bf59814 (diff) | |
download | dokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.tar.gz dokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.tar.bz2 dokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.zip |
Collect annotations from package-info.java (#2331)
Fix: #2330
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 79b4798c..d912d65f 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -150,9 +150,11 @@ class DefaultPsiToDocumentableTranslator( suspend fun parsePackage(packageName: String, psiFiles: List<PsiJavaFile>): DPackage = coroutineScope { val dri = DRI(packageName = packageName) - val documentation = psiFiles.firstOrNull { it.name == "package-info.java" }?.let { + val packageInfo = psiFiles.singleOrNull { it.name == "package-info.java" } + val documentation = packageInfo?.let { javadocParser.parseDocumentation(it).toSourceSetDependent() - } ?: emptyMap() + }.orEmpty() + val annotations = packageInfo?.packageStatement?.annotationList?.annotations DPackage( dri, @@ -166,7 +168,10 @@ class DefaultPsiToDocumentableTranslator( emptyList(), documentation, null, - setOf(sourceSetData) + setOf(sourceSetData), + PropertyContainer.withAll( + annotations?.toList().orEmpty().toListOfAnnotations().toSourceSetDependent().toAnnotations() + ) ) } |