// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection @file:Suppress("UsePropertyAccessSyntax", "UNUSED_VARIABLE", "unused", "UNUSED_PARAMETER", "DEPRECATION") import android.os.Parcel import android.os.Parcelable import kotlinx.android.parcel.Parcelize class MyParcelable1 : Parcelable { override fun describeContents() = 0 override fun writeToParcel(arg0: Parcel, arg1: Int) {} } internal class MyParcelable2 : Parcelable { override fun describeContents() = 0 override fun writeToParcel(arg0: Parcel, arg1: Int) {} companion object { @JvmField val CREATOR: Parcelable.Creator = object : Parcelable.Creator { override fun newArray(size: Int) = null!! override fun createFromParcel(source: Parcel?) = null!! } } } internal class MyParcelable3 : Parcelable { override fun describeContents() = 0 override fun writeToParcel(arg0: Parcel, arg1: Int) {} companion object { @JvmField val CREATOR = 0 // Wrong type } } class RecyclerViewScrollPosition(val position: Int, val topOffset: Int): Parcelable { override fun describeContents(): Int = 0 override fun writeToParcel(dest: Parcel, flags: Int) { dest.writeInt(position) dest.writeInt(topOffset) } companion object { @JvmField val CREATOR = object : Parcelable.Creator { override fun createFromParcel(parcel: Parcel): RecyclerViewScrollPosition { val position = parcel.readInt() val topOffset = parcel.readInt() return RecyclerViewScrollPosition(position, topOffset) } override fun newArray(size: Int): Array = arrayOfNulls(size) } } } class RecyclerViewScrollPositionWithoutJvmF(val position: Int, val topOffset: Int): Parcelable { override fun describeContents(): Int = 0 override fun writeToParcel(dest: Parcel, flags: Int) { dest.writeInt(position) dest.writeInt(topOffset) } companion object { val CREATOR = object : Parcelable.Creator { override fun createFromParcel(parcel: Parcel): RecyclerViewScrollPosition { val position = parcel.readInt() val topOffset = parcel.readInt() return RecyclerViewScrollPosition(position, topOffset) } override fun newArray(size: Int): Array = arrayOfNulls(size) } } } class RecyclerViewScrollPosition2(val position: Int, val topOffset: Int): Parcelable { override fun describeContents(): Int = 0 override fun writeToParcel(dest: Parcel, flags: Int) { dest.writeInt(position) dest.writeInt(topOffset) } companion object CREATOR: Parcelable.Creator { override fun createFromParcel(parcel: Parcel): RecyclerViewScrollPosition { val position = parcel.readInt() val topOffset = parcel.readInt() return RecyclerViewScrollPosition(position, topOffset) } override fun newArray(size: Int): Array = arrayOfNulls(size) } } internal abstract class MyParcelable4 : Parcelable { override fun describeContents() = 0 override fun writeToParcel(arg0: Parcel, arg1: Int) {} } @Parcelize class ParcelizeUser(val firstName: String, val lastName: String) : Parcelable