Reputation: 4391
Does Kotlin support java annotations like @ColorInt
, because i cannot get it to work. I can annotate a color with @ColorInt
, but don't actually get the lint checks for that annotation.
Example
fun setStatusBarColor(@ColorInt color){
window.setStatusBarColor(color)
}
When passing R.color.colorPrimary
, no lint is shown. Should show lint with R.color.colorPrimary
and don't show with resources.getColor(R.color.colorPrimary)
Upvotes: 8
Views: 2915
Reputation: 97258
The Kotlin language definitely supports all Java annotations. The Lint checks you're talking about are not part of either the Java language or the Kotlin language, but rather a feature of Android Studio and the Android plugin for IntelliJ IDEA. That feature is currently supported only for Java, and we plan to support it for Kotlin in a future update of the Kotlin plugin.
Upvotes: 10