johncarl81 / parceler

:package: Android Parcelables made easy through code generation.

Home Page:http://parceler.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parceler: Unable to find read/write generator for type java.util.List<EnumType>

bkolarov opened this issue · comments

Hello,
Parceler produces a compile time error when I use it on a Kotlin data class, that accepts an immutable list of enum values. Here is the concrete example:

@Parcel(Parcel.Serialization.BEAN)
data class FeaturesResponse @ParcelConstructor constructor(var features: List<FeatureResponse>)

enum class FeatureResponse {
    FEATURE_1, FEATURE_2,
    UNKNOWN
}

And here is the error I get:

: Parceler: Unable to find read/write generator for type java.util.List<? extends FeatureResponse> for java.util.List<? extends FeatureResponse> features java.util.List<? extends FeatureResponse> features) {
                                                                                                       ^
e: /EnabledFeaturesResponse.java:12: error: Parceler: Types do not match for property features java.util.List<? extends FeatureResponse> java.util.List<FeatureResponse> public final java.util.List<FeatureResponse> getFeatures() {                                                                                                      ^

I think a possible workaround is to replace List With MutableList as the error doesn't appear then, but the issue remains.

This was reported recently here: #366. I have a reproducible failing test case if you want to try your hand at a fix PR.