aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt15
-rw-r--r--plugins/base/src/test/kotlin/utils/contentUtils.kt1
3 files changed, 11 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index b1f50a32..1164fb77 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -74,7 +74,7 @@ internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContex
val facade = context.platforms[pd]?.facade
?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetName}") }
val descriptor = facade.resolveSession.getPackageFragment(FqName(it.name))
- ?: return@mapNotNull null.also { context.logger.warn("Could not find descriptor for $") }
+ ?: return@mapNotNull null.also { _ -> context.logger.warn("Could not find descriptor for ${it.name}") }
doc?.get("Package")?.get(it.name)?.run {
pd to MarkdownParser(
facade,
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 9c731528..efd689ba 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -17,6 +17,7 @@ import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator
import org.jetbrains.dokka.utilities.DokkaLogger
+import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
import org.jetbrains.kotlin.descriptors.Visibilities
@@ -399,7 +400,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
)
}
- private fun Collection<PsiAnnotation>.toListOfAnnotations() = mapNotNull { it.toAnnotation() }
+ private fun Collection<PsiAnnotation>.toListOfAnnotations() = filter { it !is KtLightAbstractAnnotation }.mapNotNull { it.toAnnotation() }
private fun JvmAnnotationAttribute.toValue(): AnnotationParameterValue = when (this) {
is PsiNameValuePair -> value?.toValue() ?: StringValue("")
@@ -408,7 +409,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
private fun PsiAnnotationMemberValue.toValue(): AnnotationParameterValue = when(this) {
is PsiAnnotation -> AnnotationValue(toAnnotation())
- is PsiArrayInitializerMemberValue -> ArrayValue(this.initializers.map { it.toValue() })
+ is PsiArrayInitializerMemberValue -> ArrayValue(initializers.map { it.toValue() })
is PsiReferenceExpression -> EnumValue(
text ?: "",
driOfReference()
@@ -422,11 +423,13 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
private fun PsiAnnotation.toAnnotation() = Annotations.Annotation(
driOfReference(),
- attributes.mapNotNull { it.attributeName to it.toValue() }.toMap()
+ attributes.filter { it !is KtLightAbstractAnnotation }.mapNotNull { it.attributeName to it.toValue() }.toMap()
)
- private fun PsiElement.driOfReference() = DRI.from(getChildOfType<PsiJavaCodeReferenceElement>()?.resolve() ?:
- throw IllegalStateException("$this cannot be resolved to symbol!")
- )
+ private fun PsiElement.driOfReference() = getChildOfType<PsiJavaCodeReferenceElement>()?.resolve()?.let {
+ DRI.from(it)
+ } ?: DRI("", getChildOfType<PsiJavaCodeReferenceElement>()?.qualifiedName ?: "").also {
+ logger.error("$this cannot be resolved to symbol!")
+ }
}
}
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt
index ec119ebb..4aba3e9d 100644
--- a/plugins/base/src/test/kotlin/utils/contentUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt
@@ -137,6 +137,7 @@ fun ContentMatcherBuilder<*>.propertySignature(
) {
group {
header { +"Package test" }
+ skipAllNotMatching()
}
group {
group {