My problem is like "Jackson and generic type reference", but with the added wrinkle that my generic class is abstract, so I have to map it to a concrete type. this used to work fine under Jackson v2.5.3, but recent changes in Jackson (v2.7.2 or earlier) have broken it.
I have abstract class Page and concrete class PageImpl. I used to be able to deserialize Page as PageImpl, no problem:
SimpleModule module = new SimpleModule().addAbstractTypeMapping(Page.class, PageImpl.class)
ObjectMapper objectMapper = new ObjectMapper().registerModule(module);
but now, I've learned via debugging the source, that when Jackson maps an abstract type to a concrete type, it drops type bindings. that means that if I tell Jackson to deser a given JSON string into type Page< XYZ >...
value = objectMapper.readValue(json,
typeFactory.constructSimpleType(Page.class,
new JavaType[]{typeFactory.constructSimpleType(XYZ.class, null)}));
...that it'll map the output type to PageImpl, but it drops the type bindings before deserializing the JSON into PageImpl. this results in the PageImpl POJO containing a List of LinkedHashMap objects, instead of a list of XYZ objects.
I'm not sure why Jackson was changed like this; it seems like a bug. Looking for suggestions on a workaround. thanks!