From 8c218ff4dd5f970233c43845c19299fc74256389 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Fri, 29 Apr 2022 15:03:08 +0300 Subject: Enable warnings as errors and fix all warnings (#2451) * Enable warnings as errors and fix all warnings * Enable skip-metadata-version-check compiler setting --- .../main/kotlin/signatures/JavaSignatureProvider.kt | 18 +++++++++++------- .../transformers/JvmNameDocumentableTransformer.kt | 9 ++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'plugins/kotlin-as-java/src/main/kotlin') 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 fa1f668f..1f5719ea 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt @@ -52,19 +52,23 @@ class JavaSignatureProvider internal constructor(ctcc: CommentsToContentConverte } private fun signature(c: DClasslike) = - c.sourceSets.map { + c.sourceSets.map { sourceSet -> + @Suppress("UNCHECKED_CAST") + val deprecationStyles = (c as? WithExtraProperties) + ?.stylesIfDeprecated(sourceSet) + ?: emptySet() + contentBuilder.contentFor( c, ContentKind.Symbol, - setOf(TextStyle.Monospace) + ((c as? WithExtraProperties)?.stylesIfDeprecated(it) - ?: emptySet()), - sourceSets = setOf(it) + setOf(TextStyle.Monospace) + deprecationStyles, + sourceSets = setOf(sourceSet) ) { - c.visibility[it]?.takeIf { it !in ignoredVisibilities }?.name?.plus(" ")?.let { keyword(it) } + c.visibility[sourceSet]?.takeIf { it !in ignoredVisibilities }?.name?.plus(" ")?.let { keyword(it) } if (c is DClass) { - c.modifier[it]?.takeIf { it !in ignoredModifiers }?.name?.plus(" ")?.let { keyword(it) } - c.modifiers()[it]?.toSignatureString()?.let { keyword(it) } + c.modifier[sourceSet]?.takeIf { it !in ignoredModifiers }?.name?.plus(" ")?.let { keyword(it) } + c.modifiers()[sourceSet]?.toSignatureString()?.let { keyword(it) } } when (c) { diff --git a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameDocumentableTransformer.kt b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameDocumentableTransformer.kt index 28cb3453..d937c841 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameDocumentableTransformer.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameDocumentableTransformer.kt @@ -12,8 +12,8 @@ class JvmNameDocumentableTransformer : DocumentableTransformer { return original.copy(packages = original.packages.map { transform(it, context) }) } - internal fun transform(documentable: T, context: DokkaContext): T = - with(documentable) { + internal fun transform(documentable: T, context: DokkaContext): T { + val transformResult = with(documentable) { when (this) { is DPackage -> copy( functions = functions.map { transform(it, context) }, @@ -40,7 +40,10 @@ class JvmNameDocumentableTransformer : DocumentableTransformer { this } } - } as T + } + @Suppress("UNCHECKED_CAST") + return transformResult as T + } private fun PropertyContainer.withoutJvmName(): PropertyContainer { val annotationsWithoutJvmName = get(Annotations)?.let { annotations -> -- cgit