mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Support mapping of KType to j.l.reflect.Type
This commit is contained in:
11
compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/J.java
vendored
Normal file
11
compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/J.java
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
public class J {
|
||||
private final int param;
|
||||
|
||||
public J(int param) {
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
public String foo(int[] arr, Object[] arr2, Integer y) {
|
||||
return "" + param + arr[0] + arr2[0] + y;
|
||||
}
|
||||
}
|
||||
15
compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/K.kt
vendored
Normal file
15
compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/K.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import kotlin.reflect.jvm.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
val f = J::foo
|
||||
assertEquals(
|
||||
listOf(javaClass<J>(), javaClass<IntArray>(), javaClass<Array<Any>>(), javaClass<Integer>()),
|
||||
f.parameters.map { it.type.javaType }
|
||||
)
|
||||
assertEquals(javaClass<String>(), f.returnType.javaType)
|
||||
|
||||
assertEquals("01A2", f.call(J(0), intArrayOf(1), arrayOf("A"), 2))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user