aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2021-01-15 16:04:28 +0100
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2021-01-22 10:38:05 +0100
commit88303321abb91b73a03fa62f44152e82fef0dc3a (patch)
treefebaedb3cebb27fcaf11377468a5a6ac99a52d5f /plugins/kotlin-as-java/src/main/kotlin
parentfdf8a298f586d7e334c312346b70b59c64c8d037 (diff)
downloaddokka-88303321abb91b73a03fa62f44152e82fef0dc3a.tar.gz
dokka-88303321abb91b73a03fa62f44152e82fef0dc3a.tar.bz2
dokka-88303321abb91b73a03fa62f44152e82fef0dc3a.zip
Fix incorrect DRI conversion in KotlinAsJava modes for nested definitions
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt12
1 files changed, 6 insertions, 6 deletions
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 8b21e44d..6ccc9ecc 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
@@ -198,7 +198,7 @@ internal fun DClasslike.asJava(): DClasslike = when (this) {
}
internal fun DClass.asJava(): DClass = copy(
- constructors = constructors.map { it.asJava(name) },
+ constructors = constructors.map { it.asJava(dri.classNames ?: name) }, // name may not always be valid here, however classNames should always be not null
functions = functionsInJava(),
properties = properties.map { it.asJava() },
classlikes = classlikes.map { it.asJava() },
@@ -212,7 +212,7 @@ internal fun DClass.asJava(): DClass = copy(
internal fun DClass.functionsInJava(): List<DFunction> =
(properties.filter { it.jvmField() == null }
.flatMap { property -> listOfNotNull(property.getter, property.setter) } + functions).map {
- it.asJava(name)
+ it.asJava(dri.classNames ?: name)
}
private fun DTypeParameter.asJava(): DTypeParameter = copy(
@@ -251,9 +251,9 @@ private fun Bound.asJava(): Bound = when (this) {
}
internal fun DEnum.asJava(): DEnum = copy(
- constructors = constructors.map { it.asJava(name) },
+ constructors = constructors.map { it.asJava(dri.classNames ?: name) },
functions = (functions + properties.map { it.getter } + properties.map { it.setter }).filterNotNull().map {
- it.asJava(name)
+ it.asJava(dri.classNames ?: name)
},
properties = properties.map { it.asJava() },
classlikes = classlikes.map { it.asJava() },
@@ -264,7 +264,7 @@ internal fun DEnum.asJava(): DEnum = copy(
internal fun DObject.asJava(): DObject = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
- .map { it.asJava(name.orEmpty()) },
+ .map { it.asJava(dri.classNames ?: name.orEmpty()) },
properties = properties.map { it.asJava() } +
DProperty(
name = "INSTANCE",
@@ -294,7 +294,7 @@ internal fun DObject.asJava(): DObject = copy(
internal fun DInterface.asJava(): DInterface = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
- .map { it.asJava(name) },
+ .map { it.asJava(dri.classNames ?: name) },
properties = emptyList(),
classlikes = classlikes.map { it.asJava() }, // TODO: public static final class DefaultImpls with impls for methods
generics = generics.map { it.asJava() },