I am trying to create a annotation to only allow u...
# android
r
I am trying to create a annotation to only allow use strings from constant but its not working, someone know what i am doing wrong?
Copy code
const val CONST = "value"

@StringDef(CONST)
@Retention(AnnotationRetention.SOURCE)
annotation class OnlyConstantsAllowed

fun getFromKey(@OnlyConstantsAllowed const : String) {
    //..
}
c
Hi Rapael! You can wrap multi-line code in three `s
r
sorry, done
👌 1