Closed mnefzger closed 5 years ago
Not really... care to share the class that's causing this or perhaps a small project to demonstrate?
Thank you for your quick reply. Unfortunately, I cannot point to a single class that is causing the error. I'm trying to reproduce the issue in a small project, so far without luck.
Hi John, it seems that the usage of Kotlin's sealed class is the cause of the NPE. I already tried the approach described in #274 (writing a custom converter) but it did not change anything. Please see two examples below.
Without a sealed class, everything works fine:
@Parcel(Parcel.Serialization.BEAN)
data class Item @ParcelConstructor constructor(
@SerializedName("title") val title: String,
@SerializedName("description") val description: String,
@SerializedName("drawableId") val drawableId: Int
)
When using a sealed class, I get the described NPE:
sealed class Notification {
@Parcel(Parcel.Serialization.BEAN)
data class NotificationInfo @ParcelConstructor constructor(
val status: Status,
val id: String
) : Notification()
object NoNotificationAvailable : Notification()
}
Update: The error also occurs when wrapping a data class with @Parcel
annotation inside another data class.
My guess right now is the NPE is from a package not existing? Not sure without something concrete to diagnose.
Can you share Status
@mnefzger ?
Hi John, sorry for not updating the issue. We did not find a solution and decided to replace Parceler with Kotlin Parcelize in our app so we can move on. From my side, the issue can be closed as I was not able to reproduce it in a sample project.
Sounds good, good luck!
Hi, when building our project, we receive a nullpointer exception (see stacktrace below). The error occured after we upgraded a different library that does not use Parceler. The module that makes use of Parceler did not change in any way.
Do you know what could cause this exception?
Thank you and best regards.
Parceler: 1.1.11 Build tools: 27.0.3 Gradle Build Tools: 3.0.1 Kotlin version: 1.2.50