An oddity that I stumbled over in Kotlin programming for Android is the location of type annotations.
In Android, resources are generally referenced by Integer constants. There are many different types of resources, such as ids, layouts, drawables, colors, etc. To enable better IDE linting (I guess), it is possible to add an annotation to a(n Integer) type that should actually be a reference to a certain resource.
In Java, a function that creates a grey version of a given drawable might look like this:
Bitmap createGreyBitmap(@DrawableRes int id) { ... }
In Kotlin, the same looks like this:
fun createGreyBitmap(@DrawableRes id: Int): Bitmap { ... }
The issue I have with this, is that type annotations usually (always?) relate to the type, not the name of a variable / parameter / field. So, I would have expected it to look like
id: @DrawableRes Int
I wonder what is the reasoning behind requiring the annotation at the position it is right now?