Imagine the following code:
fun <T : Serializable> List<Reference<T>>.getValues(): Array<T?> = map { it.get() }.toTypedArray()
This naturally produces the “Cannot use ‘T’ as reified type parameter. Use a class instead” error message. Yet, since this method is to be called by Java stuff, it would be great if the getValues()
method could take a parameter of type Class<T>
. Is it possible?
Thank you