Get enclosing class from KProperty1

I want to search for an annotation of the class given its property.

I actually solved my problem by “going-to-Java-and-back-to-Kotlin way”:

val annotation = KProperty1<*, *>.javaField?.declaringClass?.kotlin?.findAnnotation<MyAnnotation>()
1 Like