mcharmas/android-parcelable-intellij-plugin

Issue with List<String>

dmytrolavrikov opened this issue · 3 comments

In release 0.6.1 generation for fields like private List<String> names; results in something like this:

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.names);
    }

    private Contact(Parcel in) {
        this.names = new ArrayList<List<String>>();
        in.readList(this.names, List<String>.class.getClassLoader());
    }

Which, obviously, does not compile. :)
I suggest that for lists of strings you should use writeStringList() and readStringList(), for example:

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeStringList(this.names);
    }

    private Contact(Parcel in) {
        this.names = new ArrayList<String>();
        in.readStringList(this.names);
    }

An excellent update!

This should be fixed in 0.6.2 (in review by JetBrains).