KProperty1<T, R> doesn’t have an extension for getting the enclosing class? I tried to define my own, but since it is an
inline function, I cannot use it without breaking the existing code base.
Basically, I want something like this:
inline fun <reified T : Any> KProperty1<T, *>.getEnclosingClass(): KClass<T> = T::class
But when I call it on instance of
KProperty1<T, *> in my code, I get “cannot use T as reified type parameter. Use a class instead.”