diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-03-11 16:55:40 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-11 18:25:01 +0100 |
commit | 8e4ffa367b43cdc57c3921fab2182a4209913a51 (patch) | |
tree | e4e03996eab0372b642978f0540079efdb6da191 /plugins/base/src/main/kotlin/signatures | |
parent | 93b8ae8a552ed88f50e4f17a5906ddeedb77e639 (diff) | |
download | dokka-8e4ffa367b43cdc57c3921fab2182a4209913a51.tar.gz dokka-8e4ffa367b43cdc57c3921fab2182a4209913a51.tar.bz2 dokka-8e4ffa367b43cdc57c3921fab2182a4209913a51.zip |
Use Bounds instead of Wrappers to describe types
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index b468c56b..3c4698fe 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -2,6 +2,8 @@ package org.jetbrains.dokka.base.signatures import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.links.DriOfUnit import org.jetbrains.dokka.links.sureClassNames import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Annotation @@ -53,25 +55,25 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog platformText(f.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " } text(f.modifier.name + " ") text("fun ") + list(f.generics, prefix = "<", suffix = "> ") { + +buildSignature(it) + } f.receiver?.also { - type(it.type) + signatureForProjection(it.type) text(".") } link(f.name, f.dri) - list(f.generics, prefix = "<", suffix = ">") { - +buildSignature(it) - } text("(") list(f.parameters) { text(it.name!!) text(": ") - type(it.type) + signatureForProjection(it.type) } text(")") val returnType = f.type - if (!f.isConstructor && returnType.constructorFqName != Unit::class.qualifiedName) { + if (!f.isConstructor && returnType is TypeConstructor && returnType.dri != DriOfUnit) { text(": ") - type(returnType) + signatureForProjection(returnType) } } @@ -103,5 +105,12 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog signatureForProjection(p.inner) text("?") } + + is PrimitiveJavaType -> signatureForProjection(p.translateToKotlin()) } } + +private fun PrimitiveJavaType.translateToKotlin() = TypeConstructor( + dri = DRI("kotlin", name.capitalize()), + projections = emptyList() +) |