Parcelable: Handle nullability in Parcelize Parcelable serializer (KT-20032)

This commit is contained in:
Yan Zhulanow
2017-09-01 23:22:30 +03:00
committed by Yan Zhulanow
parent 88138fc420
commit a03c03c427
2 changed files with 8 additions and 4 deletions
@@ -7,17 +7,21 @@ import kotlinx.android.parcel.*
import android.os.Parcel
import android.os.Parcelable
@Parcelize
data class Foo(val a: String) : Parcelable
@Parcelize
data class Test(
val str1: String,
val str2: String?,
val int1: Int,
val int2: Int?
val int2: Int?,
val foo: Foo?
) : Parcelable
fun box() = parcelTest { parcel ->
val first = Test("John", "Smith", 20, 30)
val second = Test("A", null, 20, null)
val first = Test("John", "Smith", 20, 30, Foo("a"))
val second = Test("A", null, 20, null, null)
first.writeToParcel(parcel, 0)
second.writeToParcel(parcel, 0)