FasterXML / jackson-modules-base

Uber-project for foundational modules of Jackson that build directly on core components but nothing else; not including data format or datatype modules
Apache License 2.0
167 stars 77 forks source link

Problem deserializing a class with ancestors #203

Closed danjee closed 1 year ago

danjee commented 1 year ago

Issue deserializing a spring data PageImpl. I've excluded the legacy afterburner from my dependencies and a deserializer started failing. My custom class is extending PageImpl which extends Chunk.

@JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"})
public class RestPage<T> extends PageImpl<T> {

    private static final long serialVersionUID = 851236798223548446L;

    @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
    public RestPage(
            @JsonProperty("content") final List<T> content,
            @JsonProperty("page") final int page,
            @JsonProperty("size") final int size,
            @JsonProperty("totalElements") final long total) {
        super(content, PageRequest.of(page, size), total);
    }

    public RestPage(final Page<T> page) {
        super(page.getContent(), page.getPageable(), page.getTotalElements());
    }
}

The error I get is: java.lang.IllegalAccessException: class is not public: org.springframework.data.domain.Chunk.getContent

I'm using latest version 2.14.2 under java17

cowtowncoder commented 1 year ago

We would need a reproduction to see what is happening: description alone isn't sufficient.

I am not 100% clear for example if failure is with or without Afterburner (I assume with since it's filed here... ?).

I would suggest trying 2.15.1 that was just released, just in case.

cowtowncoder commented 1 year ago

Cannot reproduce, closing. May be re-opened/re-filed with test case.