Can't make the parcelization work as expceted. That is the class:
@Parcelize
class ResultsWrapper<T>(
@SerializedName("results") var results: T
): Parcelable
In that case it says: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'
Parcelization can't know the T implements Parcelable? No problem. Writing like this:
@Parcelize
class ResultsWrapper<T: Parcelable>(
@SerializedName("results") var results: T
): Parcelable
Now there is no compilation error, but there is build time error:
error: non-static type variable T cannot be referenced from a static context (in newArray and createFromParcel generated functions in static Creator)
Using @RawValue lead to same error.
How to make it right?