Recently, Android Studio has started highlighting some annotation usages in my Kotlin code. I get the following warning:
The annotation is only applied to the parameter.
An explicit annotation use-site target is recommended.

Adding an explicit annotation use-site target fixes the warning. However, I’m wondering whether I should add it every time, or whether it only matters in specific cases.
Since this is only a warning, when is it actually necessary to add an explicit use-site target?
Thanks for your help!
Ommiting the target is dangerous, because a single Kotlin properly generates multiple Java elements (field, getter, construtor parameter) behind the scenes and Kotlin default choice might be counter-intuitive.
Framework like Hilt, Room, Moshi look for annotations on very specific elements, such as the underlying Java Field.
If the annotation end up on the wronf element, the library will completely miss i, leading to broken JSON parsing, faulty database schemas, or runtime NullPointerException crashes during dependency injection.
You should always use-site targets (like @field:Inject or @field:SerializedName ) whenever your code interacts with external frameworks or data serialization libraries.