Sangmin Lee
// Annotation below @Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) annotation class MyAnnotation // Class data class MyClass ( @MyAnnotation var myProperty: String, @MyAnnotation var maybeICouldBeField: String ) // Verification Code val KProperties = MyClass::class.memberProperties KProperties.forEach() { println(it.annotations) println(it?.javaField?.annotations) }
thanksforallthefish
@field:MyAnnotation
Roukanken
it.annotations
ephemient
If there are multiple applicable targets, the first applicable target from the following list is used:
- param
- property
- field
@param:
@field:
A modern programming language that makes developers happier.