aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-04-29 15:03:08 +0300
committerGitHub <noreply@github.com>2022-04-29 15:03:08 +0300
commit8c218ff4dd5f970233c43845c19299fc74256389 (patch)
treeb6818183ce8faa2c58d6571ca1c86aa28d4f0431 /plugins/kotlin-as-java
parent84aacad29982240ae367b21e9d283d38dab672ae (diff)
downloaddokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.gz
dokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.bz2
dokka-8c218ff4dd5f970233c43845c19299fc74256389.zip
Enable warnings as errors and fix all warnings (#2451)
* Enable warnings as errors and fix all warnings * Enable skip-metadata-version-check compiler setting
Diffstat (limited to 'plugins/kotlin-as-java')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt18
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameDocumentableTransformer.kt9
2 files changed, 17 insertions, 10 deletions
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<out Documentable>)
+ ?.stylesIfDeprecated(sourceSet)
+ ?: emptySet()
+
contentBuilder.contentFor(
c,
ContentKind.Symbol,
- setOf(TextStyle.Monospace) + ((c as? WithExtraProperties<out Documentable>)?.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 <T : Documentable> transform(documentable: T, context: DokkaContext): T =
- with(documentable) {
+ internal fun <T : Documentable> 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<DFunction>.withoutJvmName(): PropertyContainer<DFunction> {
val annotationsWithoutJvmName = get(Annotations)?.let { annotations ->