Support mapping between Kotlin functions and JVM methods/constructors

This commit is contained in:
Alexander Udalov
2015-07-15 23:33:37 +03:00
parent 93656c93c1
commit 936bede8b1
14 changed files with 323 additions and 38 deletions

View File

@@ -0,0 +1,12 @@
import kotlin.reflect.*
import kotlin.reflect.jvm.*
import javaConstructor as J
fun box(): String {
val reference = ::J
val javaConstructor = reference.javaConstructor ?: return "Fail: no Constructor for reference"
val j = javaConstructor.newInstance("OK")
val kotlinConstructor = javaConstructor.kotlinFunction
if (reference != kotlinConstructor) return "Fail: reference != kotlinConstructor"
return j.result
}