https://kotlinlang.org logo
Title
p

Paul Woitaschek

09/20/2018, 2:33 PM
For me it compiles without casting them to long @memphis
m

memphis

09/20/2018, 2:35 PM
That’s weird
p

Paul Woitaschek

09/20/2018, 2:42 PM
Maybe your kotlin plugin is outdated?
Cmd-Click on the IntDef class
@Retention(SOURCE)
@Target({ANNOTATION_TYPE})
public @interface IntDef {
    /** Defines the allowed constants for this element */
    int[] value() default {};

    /** Defines whether the constants can be used as a flag, or just as an enum (the default) */
    boolean flag() default false;
}
I'm using androidX 1.0.0-rc02, maybe they changed it from int to long
However you might use
TYPE_HEADER = 0L
if it's long for you
m

memphis

09/20/2018, 2:45 PM
@Retention(SOURCE)
@Target({ANNOTATION_TYPE})
public @interface IntDef {
    /** Defines the allowed constants for this element */
    long[] value() default {};

    /** Defines whether the constants can be used as a flag, or just as an enum (the default) */
    boolean flag() default false;
}
Yeah I’m using
v1.2.51
I used that
TYPE_HEADER = 0L
still get the same error
I have updated Kotlin version to
v1.2.70
now it’s changed to
Int
p

Paul Woitaschek

09/20/2018, 3:01 PM
Maybe you had an updated plugin but no updated kotlin version
m

memphis

09/20/2018, 3:24 PM
You’re right ! Thanks man 👍