Hello guys, I’m using `@IntDef` annotation as belo...
# android
m
Hello guys, I’m using
@IntDef
annotation as below
Copy code
companion object {
        @Retention(AnnotationRetention.SOURCE)
        @IntDef(
                TYPE_HEADER.toLong(),
                TYPE_FOOTER.toLong()
        )
        annotation class AdapterItemType

        const val TYPE_HEADER = 0
        const val TYPE_FOOTER = 2
    }
I noticed that values inside
@IntDef
must be of type
Long
and not
Int
.. But in compilation, I get this error :
error: incompatible types: possible lossy conversion from long to int
Any idea? 🙂
b
try this
Copy code
const val TYPE_HEADER = 0L
 const val TYPE_FOOTER = 2L
and remove the
toLong()
calls