From b05eb93d345cccd0cae9393f99acd428012d1106 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Tue, 25 Aug 2020 14:51:53 +0200 Subject: Add handling for generic type parameters variance --- .../src/main/kotlin/converters/KotlinToJavaConverter.kt | 2 +- .../src/main/kotlin/signatures/JavaSignatureProvider.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/kotlin-as-java') diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt index 58c62622..f169f89a 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt @@ -172,7 +172,7 @@ internal fun DClass.asJava(): DClass = copy( ) private fun DTypeParameter.asJava(): DTypeParameter = copy( - dri = dri.possiblyAsJava(), + variantTypeParameter = variantTypeParameter.withNewDri(dri.possiblyAsJava()), bounds = bounds.map { it.asJava() } ) diff --git a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt index 5134bd4d..d9b9dc5b 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt @@ -141,7 +141,7 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge private fun signature(t: DTypeParameter) = t.sourceSets.map { contentBuilder.contentFor(t, styles = t.stylesIfDeprecated(it), sourceSets = setOf(it)) { - text(t.name.substringAfterLast(".")) + text(t.name.substringAfterLast(".")) // Investigate if java classes can be somehow variant list(t.bounds, prefix = " extends ") { signatureForProjection(it) } @@ -159,8 +159,8 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge } } - is Variance -> group(styles = emptySet()) { - text(p.kind.toString() + " ") // TODO: "super" && "extends" + is Variance<*> -> group(styles = emptySet()) { + text("$p ".takeIf { it.isNotBlank() } ?: "") // TODO: "super" && "extends" signatureForProjection(p.inner) } -- cgit