https://kotlinlang.org logo
#announcements
Title
# announcements
d

damian

05/05/2017, 2:02 AM
I think the problem is that the KClass is of
java.lang.Double
@groostav playing around in the repl, I can't get a KClass of
java.lang.Double
... it seems to want to convert to
kotlin.Double
. Maybe you're getting some weird type inference edge case?
(also, in this particular example, why not just make extensions on
Pointer<Double>
,
Pointer<Int>
, etc directly?)
Copy code
@JvmName("toDoubleList")
fun Pointer<Double>.toList(size: Int) = pointer.getDoubleArray(0, size).asList()
@JvmName("toIntList")
fun Pointer<Int>.toList(size: Int) = pointer.getIntArray(0, size).asList()
g

groostav

05/07/2017, 6:32 AM
thats a really good question. I've used that feature but my java brain still doesnt understand extension functions on closed-generic types
2 Views