Skip to content

Cannot assign a value to final variable #217

@shengdoushi

Description

@shengdoushi

`

@JsonObject
public class BaseItem {
    @JsonField
    public int base = 0;
}

@JsonObject
public class Item<T> extends BaseItem {
    @JsonField
    public T name;
}

`

will compile error:

Cannot assign a value to final variable 'parentObjectMapper'

the error code below:

`
public final class Item$$JsonObjectMapper extends JsonMapper<Item> {
private static final JsonMapper parentObjectMapper = LoganSquare.mapperFor(BaseItem.class);

        private final JsonMapper<T> m84ClassJsonMapper;

        public Item$$JsonObjectMapper(ParameterizedType type, ParameterizedType TType, SimpleArrayMap<ParameterizedType, JsonMapper> partialMappers) {
             partialMappers.put(type, this);
             m84ClassJsonMapper = LoganSquare.mapperFor(TType, partialMappers);
             parentObjectMapper = LoganSquare.mapperFor(new ParameterizedType<BaseItem>() { }); // This line error
 }

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions