# java-to-kotlin-refactoring

Darryl Miles

03/03/2024, 5:26 AM
Trying to recover validation-api annotations from JPA entites in Kotlin however it appears the CLASS level annotations are in the expected place But the column/field/member/accessor-property-method annotations are in some other (secret/hidden) place like:
Copy code
val kclass = MyEntity::class
val randomMember = kclass.members.findLast { == "randomProperty" }  // KCallable<*>
val kmutable = if(randomMember is KMutableProperty) randomMember as KMutableProperty else null  // KMutableProperty is the real type
val javaField = kmutable?.annotations  // this is the only non-empty annotations field/member/method/property that exists around "randomProperty"