aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin/converters
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-03-03 19:56:07 +0100
committerKamil Doległo <kamilok1965@users.noreply.github.com>2020-03-04 18:00:19 +0100
commit8ea1e6752aadc7da2bd9e1fff7f4040d16e3d864 (patch)
tree106203e2a17b7b6d49603d8b0d3841e2222a24ad /plugins/kotlin-as-java/src/main/kotlin/converters
parente4044ec67ad90041b02bb84c4b966ffeac537617 (diff)
downloaddokka-8ea1e6752aadc7da2bd9e1fff7f4040d16e3d864.tar.gz
dokka-8ea1e6752aadc7da2bd9e1fff7f4040d16e3d864.tar.bz2
dokka-8ea1e6752aadc7da2bd9e1fff7f4040d16e3d864.zip
Improve JavaSignatureProvider
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin/converters')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt11
1 files changed, 6 insertions, 5 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 19c4ef19..f7fc57ff 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
@@ -61,6 +61,7 @@ internal fun Property.asJava(isTopLevel: Boolean = false, relocateToClass: Strin
} else {
dri.withClass(relocateToClass)
},
+// name = name.o,
modifier = if (setter == null) {
WithAbstraction.Modifier.Final
} else {
@@ -113,7 +114,8 @@ internal fun Function.asJava(containingClassName: String): Function {
// dri = dri.copy(callable = dri.callable?.asJava()),
name = newName,
type = type.asJava(),
- parameters = parameters.map { it.asJava() }
+ parameters = listOfNotNull(receiver?.asJava()) + parameters.map { it.asJava() },
+ receiver = null
) // TODO: should receiver be the first param?
}
@@ -129,9 +131,7 @@ internal fun Classlike.asJava(): Classlike = when (this) {
internal fun Class.asJava(): Class = copy(
constructors = constructors.map { it.asJava(name) },
functions = (functions + properties.map { it.getter } + properties.map { it.setter }).filterNotNull().map {
- it.asJava(
- name
- )
+ it.asJava(name)
},
properties = properties.map { it.asJava() },
classlikes = classlikes.map { it.asJava() }
@@ -191,7 +191,8 @@ internal fun Annotation.asJava(): Annotation = copy(
) // TODO investigate if annotation class can have methods and properties not from constructor
internal fun Parameter.asJava(): Parameter = copy(
- type = type.asJava()
+ type = type.asJava(),
+ name = if (name.isNullOrBlank()) "\$self" else name
)
internal fun String.getAsPrimitive(): JvmPrimitiveType? = org.jetbrains.kotlin.builtins.PrimitiveType.values()