Rajan Kalion Stack Overflow • Recommends
On “Restricting values in parameters via annotations Kotlin”
Firstly, it is not Kotlin compiler which checks for this type of annotation errors, Android Lint does, also this might work and preferred over enums in Java , but in Kotlin , the only way to do these are using enums , You can still use @IntDef in Kotlin to provide suggestions but other values won't give you a compile error. Also with ART, mem footprint for enums are not a big deal, this was also covered in Google IO 2018 while talking about ART link to this video