Consider the following annotation class
@Target(AnnotationTarget.TYPE)
annotation class ML(val size: Int)
By default, the retention policy is RUNTIME
, thus this annotation must be accessible through reflection.
Now I have
val a: @ML(2) List<Int> = listOf(1)
which does compile, but, if examined in the debugger, one gets
a::class.annotations.size = 0
What am I doing incorrectly and what is the correct way to annotate types without wrapping things into classes and annotating properties?