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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With