This is an simplified example of what I try to do but still failed
class Definition {
@Target(AnnotationTarget.TYPE, AnnotationTarget.VALUE_PARAMETER)
@IntDef(View.VISIBLE, View.INVISIBLE, View.GONE)
//only 0,4,8 are allowed
@Retention(AnnotationRetention.SOURCE)
annotation class Visibility
}
fun isVisibleView(@Definition.Visibility visibility: Int, viewList: ArrayList<View>, ) {
for (view in viewList) {
view.visibility = visibility
}
}
//I want the ide to SHOW ERROR here since 2 is not in 0,4,8 (show before compile)
isVisibleView(2, visibleItems)
I think this question is about IDE config or Kotlin syntax