albertgao
01/23/2018, 4:24 AMparam.type === nz.salect.objJSON.JVMBranchTest.MenuObject? where param:KParameter. But when I tried to get the class definition from param.type via param.type::class. Instead of getting the above MenuObject, I get a class kotlin.reflect.jvm.internal.KTypeImpl. How to get my own class , I mean, a KClass ? Thanks 🙂albertgao
01/23/2018, 4:35 AMparam.type.classifier as KClass<*>udalov
param.type.jvmErasure might be more helpfulalbertgao
01/23/2018, 11:10 PMjvmErasure and classifier ?udalov
jvmErasure returns the class that represents the erasure of the given type on JVM. For normal classes, this is always simply that class. For generic type parameters, this is the erasure of the generic bound, or Any if there's no bound.
For example, erasure of a simple type like String is class String itself. Erasure of a type List<String> is class List.
Erasure of T in fun <T> foo() {} is class Any. Erasure of Y in fun <X : Set<String>, Y : X> bar() {} is class Set.