Works fine if you do this: val parcelList = Parc...
# announcements
k
Works fine if you do this: val parcelList = ParcelableUtils.createBooleanArrayList(parcel) as ArrayList<Boolean?> to force it, but the IDE thinks that the stuff on the right is a useless cast.
k
you can do
val parcelList : ArrayList<Boolean?> = ParcelableUtils.createBooleanArrayList(parcel)
all in all, this is a long standing discussion. during development kotlin used to infer all java declarations as nullable by default. this caused so much pain (null checks,
?.
,
!!
everywhere) that the team decided to rvert this and introduced platform types
ArrayList<Boolean!>!
which means "I don't know if this is nullable or not, you decide". like everything in language design, it's a trade-off.
k
ahhh...I missed that discussion. Thanks 🙂 Oddly, I prefer the "As" syntax because it reminds me of C#. The other way gets rid of the IDE warning though.