elect
05/17/2018, 8:24 AMKProperty1.returnType
is an Array type via reflectiondiesieben07
05/17/2018, 8:43 AMArray<T>
where T
is a primitive. For a val foo: Array<Int>
returnType.classifier
gives kotlin.IntArray
, but Array<Int>::class
gives kotlin.Array
.elect
05/17/2018, 8:48 AMdiesieben07
05/17/2018, 8:50 AMArray<Int>::class
and IntArray::class
, that should work.elect
05/17/2018, 8:52 AMwhen
?diesieben07
05/17/2018, 8:53 AMArray<Int>
and IntArray
? If so, you'll probably have to go to Java reflection.elect
05/17/2018, 8:53 AMdiesieben07
05/17/2018, 8:54 AMis
checks on that.elect
05/17/2018, 8:56 AMdiesieben07
05/17/2018, 8:57 AMelect
05/17/2018, 8:57 AMreturnType.jvmErasure.java.isArray
diesieben07
05/17/2018, 9:00 AMjava.lang.reflect.Array
) to access it.elect
05/17/2018, 9:01 AMdiesieben07
05/17/2018, 9:02 AMelect
05/17/2018, 9:22 AMjava.lang.reflect.Array.getLength(..)
?diesieben07
05/17/2018, 9:22 AMelect
05/17/2018, 9:22 AMKProperty1
?this
and many others, but it always throws excdiesieben07
05/17/2018, 9:24 AMval array = property.get(<instance to get property from>)
val length = java.lang.reflect.Array.getLength(array)
elect
05/17/2018, 9:41 AMCaused by: java.lang.IllegalAccessException: class kotlin.reflect.jvm.internal.FunctionCaller$Method cannot access a member of class vkk.Test with modifiers "public final"
diesieben07
05/17/2018, 9:43 AMelect
05/17/2018, 10:50 AM