The drawbacks of migrating to Kotlin
Benjamin Monjoie
47011

To annotate the getter and setter, you don’t need to use @JvmField and write:

@Status
@JvmField
protected var status: Int = 0
@Status
fun getStatus() = status
fun setStatus(@Status status: Int) {
this.status = status
}

Instead you can simply write:

var status: Int = 0
@Status get
set
(@Status value) {
field = value
}

Also, I believe @IntDef and @StringDef annotations are designed to be removed during compilation by specifying @Retention(AnnotationRetention.SOURCE) because they are checked by Lint or some Android plugin before or during compilation. Right now I believe this doesn’t work with Kotlin source files so even if you properly declare your annotations they are not enforced at all and then they are removed from bytecode, which means they are basically useless until tools are updated to properly support them. (Note: I’m not using Android Studio 3 yet, maybe things have improved in that version)

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.