Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin support for @ColorInt Java Annotation

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)

like image 214
johnny_crq Avatar asked Aug 04 '16 11:08

johnny_crq


1 Answers

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.

like image 160
yole Avatar answered Sep 19 '22 06:09

yole