package org.jetbrains.dokka.base.signatures import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.base.signatures.KotlinSignatureUtils.drisOfAllNestedBounds import org.jetbrains.dokka.model.AnnotationTarget interface JvmSignatureUtils { fun PageContentBuilder.DocumentableContentBuilder.annotationsBlock(d: AnnotationTarget) fun PageContentBuilder.DocumentableContentBuilder.annotationsInline(d: AnnotationTarget) fun WithExtraProperties.modifiers(): SourceSetDependent> fun Collection.toSignatureString(): String = joinToString("") { it.name.toLowerCase() + " " } @Suppress("UNCHECKED_CAST") fun Documentable.annotations() = (this as? WithExtraProperties)?.annotations() ?: emptyMap() fun WithExtraProperties.annotations(): SourceSetDependent> = extra[Annotations]?.directAnnotations ?: emptyMap() @Suppress("UNCHECKED_CAST") operator fun > SourceSetDependent.plus(other: SourceSetDependent): SourceSetDependent = LinkedHashMap(this).apply { for ((k, v) in other) { put(k, get(k).let { if (it != null) (it + v) as T else v }) } } fun DProperty.annotations(): SourceSetDependent> = (extra[Annotations]?.directAnnotations ?: emptyMap()) + (getter?.annotations() ?: emptyMap()).mapValues { it.value.map { it.copy( scope = Annotations.AnnotationScope.GETTER) } } + (setter?.annotations() ?: emptyMap()).mapValues { it.value.map { it.copy( scope = Annotations.AnnotationScope.SETTER) } } private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: AnnotationTarget, ignored: Set, styles: Set