Is there a way in Kotlin to print through reflection the type o a class like Selected<Person>? The goal is to print “Selected<Person>“, but with normal reflection methods it is not possible. The only result at runtime is “Selected”.
d
diesieben07
11/17/2020, 3:19 PM
A class (as in
KClass
) can not represent that. You need a
KType
, which you can get using
typeOf<Selected<Person>>()
d
Dario Pellegrini
11/17/2020, 3:43 PM
Nice! It works! Thank you very much!
Dario Pellegrini
11/17/2020, 3:44 PM
Unfortunately type of needs for ExperimentalStdlibApi, but I think it is the only option