diesieben07
03/23/2018, 10:01 AMKType.classifier
will give you that, but it does not have to be a KClass
, it could be a KTypeParameter
. There is also KType.jvmErasure
, which will loose type information though.v79
03/23/2018, 10:10 AMwhen(consP.type.classifier) { is kotlin.String -> \\... }
though, as I still have incompatible types.diesieben07
03/23/2018, 10:11 AMclassifier
is a KClassifier?
. The type might not be a pure KClass
.v79
03/23/2018, 10:14 AMdiesieben07
03/23/2018, 10:16 AMclass MyClass<T>(value: T)
You can pass in a String
only if T
is String
, but that is not knowable at runtime, since generics are erased.v79
03/23/2018, 10:22 AMdiesieben07
03/23/2018, 10:23 AMjvmErasure
is what you want I think.v79
03/23/2018, 10:28 AM