Support calling methods annotated with PolymorphicSignature
#KT-14416 Fixed #KT-26165 Fixed
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +PolymorphicSignature
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FULL_JDK
|
||||
// SKIP_JDK6
|
||||
// WITH_REFLECT
|
||||
|
||||
import java.lang.invoke.MethodHandles
|
||||
import kotlin.reflect.jvm.javaMethod
|
||||
|
||||
inline class Z(val s: String)
|
||||
|
||||
fun foo(z: Z): String = z.s
|
||||
|
||||
fun box(): String {
|
||||
val mh = MethodHandles.lookup().unreflect(::foo.javaMethod!!)
|
||||
|
||||
// TODO: it's unclear whether this should throw or not, see KT-28214.
|
||||
val r1 = mh.invokeExact(Z("OK")) as String
|
||||
if (r1 != "OK") return "Fail r1: $r1"
|
||||
|
||||
return mh.invokeExact("OK") as String
|
||||
}
|
||||
Reference in New Issue
Block a user