Annotations in Kotlin can have different use-site targets as explained here: https://kotlinlang.org/docs/reference/annotations.html#annotation-use-site-targets
My qu
The reference says:
If you don’t specify a use-site target, the target is chosen according to the
@Target
annotation of the annotation being used. If there are multiple applicable targets, the first applicable target from the following list is used:
param
(constructor parameter)property
(annotations with this target are not visible to Java)field
So if your annotation has @Target({ElementType.FIELD})
, the annotation in Kotlin will target @field:
.
If it has no @Target
specified, it may be used on any program element: the @property:
target is also applicable and is chosen by default.