aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin')
-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 ->