gian
12/01/2022, 12:31 PMParcelize
-annotated data class that contains a property whose type is a value class. E.g.:
@Parcelize data class Example(val id: Id) : Parcelable
@JvmInline value class Id(val long: Long)
With Kotlin 1.6.10 this compiles and work. However, after updating to Kotlin 1.7.20, I started getting the following error a compile time:
Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'
I'm not sure I understand why this stopped compiling, but is using @RawValue
the actual solution or is there a better one? It feels like a workaround that could break at runtime if the wrapped type changes to one that isn't Parcelable
.ephemient
12/01/2022, 3:23 PMgian
12/01/2022, 3:54 PMNéstor Díazgranados
04/25/2023, 1:30 AM