https://kotlinlang.org logo
#android
Title
# android
m

memphis

09/20/2018, 2:20 PM
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

budibit

09/27/2018, 8:55 AM
try this
Copy code
const val TYPE_HEADER = 0L
 const val TYPE_FOOTER = 2L
and remove the
toLong()
calls