diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt (renamed from plugins/base/src/main/kotlin/signatures/JvmSingatureUtils.kt) | 22 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt | 5 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/KotlinSignatureUtils.kt | 9 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/SignatureProvider.kt | 4 |
4 files changed, 14 insertions, 26 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSingatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index dde553b9..0ae72109 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSingatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -1,11 +1,10 @@ package org.jetbrains.dokka.base.signatures -import javaslang.Tuple2 import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.properties.WithExtraProperties -interface JvmSingatureUtils { +interface JvmSignatureUtils { fun PageContentBuilder.DocumentableContentBuilder.annotationsBlock(d: Documentable) @@ -20,7 +19,7 @@ interface JvmSingatureUtils { extra[Annotations]?.content ?: emptyList() private fun Annotations.Annotation.toSignatureString(): String = - "@${this.dri.classNames}(${this.params.entries.joinToString { it.key + "=" + it.value }})" + "@" + this.dri.classNames + "(" + this.params.entries.joinToString { it.key + "=" + it.value } + ")" private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, @@ -45,15 +44,10 @@ interface JvmSingatureUtils { } } ?: Unit - fun <T : Documentable> WithExtraProperties<T>.modifiersWithFilter( - filter: Set<ExtraModifiers> = ExtraModifiers.values().toSet() - ): Set<ExtraModifiers> = - extra[AdditionalModifiers]?.content?.filter { it in filter }?.toSet() ?: emptySet() - fun PageContentBuilder.DocumentableContentBuilder.toSignatureString( a: Annotations.Annotation, renderAtStrategy: AtStrategy, - listBrackets: Tuple2<Char, Char>, + listBrackets: Pair<Char, Char>, classExtension: String ) { when (renderAtStrategy) { @@ -78,17 +72,17 @@ interface JvmSingatureUtils { private fun PageContentBuilder.DocumentableContentBuilder.valueToSignature( a: AnnotationParameterValue, renderAtStrategy: AtStrategy, - listBrackets: Tuple2<Char, Char>, + listBrackets: Pair<Char, Char>, classExtension: String ): Unit = when (a) { is AnnotationValue -> toSignatureString(a.annotation, renderAtStrategy, listBrackets, classExtension) is ArrayValue -> { - text(listBrackets._1.toString()) + text(listBrackets.first.toString()) a.value.forEachIndexed { i, it -> valueToSignature(it, renderAtStrategy, listBrackets, classExtension) if (i != a.value.size - 1) text(", ") } - text(listBrackets._2.toString()) + text(listBrackets.second.toString()) } is EnumValue -> link(a.enumName, a.enumDri) is ClassValue -> link(a.className + classExtension, a.classDRI) @@ -99,7 +93,7 @@ interface JvmSingatureUtils { d: Documentable, ignored: Set<Annotations.Annotation>, renderAtStrategy: AtStrategy, - listBrackets: Tuple2<Char, Char>, + listBrackets: Pair<Char, Char>, classExtension: String ) { annotations(d, ignored) { @@ -113,7 +107,7 @@ interface JvmSingatureUtils { d: Documentable, ignored: Set<Annotations.Annotation>, renderAtStrategy: AtStrategy, - listBrackets: Tuple2<Char, Char>, + listBrackets: Pair<Char, Char>, classExtension: String ) { annotations(d, ignored) { diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 4c689abc..33c82458 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -6,7 +6,6 @@ import org.jetbrains.dokka.links.* import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Nullable import org.jetbrains.dokka.model.TypeConstructor -import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.ContentKind import org.jetbrains.dokka.pages.ContentNode @@ -15,7 +14,7 @@ import org.jetbrains.dokka.utilities.DokkaLogger import kotlin.text.Typography.nbsp class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogger) : SignatureProvider, - JvmSingatureUtils by KotlinSignatureUtils { + JvmSignatureUtils by KotlinSignatureUtils { private val contentBuilder = PageContentBuilder(ctcc, this, logger) private val ignoredVisibilities = setOf(JavaVisibility.Public, KotlinVisibility.Public) @@ -69,7 +68,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog if (c is DClass) { platformText(c.modifier, sourceSets) { if (it !in ignoredModifiers) - if (c.extra[AdditionalModifiers]?.content?.contains(ExtraModifiers.DATA) == true) "" + if (c.extra[AdditionalModifiers]?.content?.contains(ExtraModifiers.KotlinOnlyModifiers.Data) == true) "" else (if (it is JavaModifier.Empty) KotlinModifier.Open else it).let { it.name + " " } else "" diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureUtils.kt index 3ce4be0a..48cfe304 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureUtils.kt @@ -1,16 +1,15 @@ package org.jetbrains.dokka.base.signatures -import javaslang.Tuple2 import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder +import org.jetbrains.dokka.model.AdditionalModifiers import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.ExtraModifiers -import org.jetbrains.dokka.model.ExtraModifiers.Companion.kotlinOnlyModifiers import org.jetbrains.dokka.model.properties.WithExtraProperties -object KotlinSignatureUtils : JvmSingatureUtils { +object KotlinSignatureUtils : JvmSignatureUtils { private val strategy = OnlyOnce - private val listBrackets = Tuple2('[', ']') + private val listBrackets = Pair('[', ']') private val classExtension = "::class" override fun PageContentBuilder.DocumentableContentBuilder.annotationsBlock(d: Documentable) = @@ -20,5 +19,5 @@ object KotlinSignatureUtils : JvmSingatureUtils { annotationsInlineWithIgnored(d, emptySet(), strategy, listBrackets, classExtension) override fun <T : Documentable> WithExtraProperties<T>.modifiers() = - modifiersWithFilter(kotlinOnlyModifiers) + extra[AdditionalModifiers]?.content?.filterIsInstance<ExtraModifiers.KotlinOnlyModifiers>()?.toSet() ?: emptySet() }
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/signatures/SignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/SignatureProvider.kt index 7d7995b7..c04b6ecf 100644 --- a/plugins/base/src/main/kotlin/signatures/SignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/SignatureProvider.kt @@ -1,11 +1,7 @@ package org.jetbrains.dokka.base.signatures -import javaslang.Tuple2 -import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.model.* -import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.ContentNode -import org.jetbrains.dokka.pages.TextStyle interface SignatureProvider { fun signature(documentable: Documentable): ContentNode |