-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
If multiple modules are used to map abstract types, deserialization might fail in 2.9+:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of
model.Datatype1
(no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
The bug can be reproduced for version 2.9+ in the attached maven project.
I guess the bug was introduced due to a modification of _mapAbstractType2 in com.fasterxml.jackson.databind.deser.BasicDeserializerFactory:
2.9:
JavaType concrete = resolver.findTypeMapping(config, type);
if (ClassUtil.rawClass(concrete) != currClass) {
return concrete;
}
2.8
if (concrete != null && concrete.getRawClass() != currClass) {
return concrete;
}
The not null check is needed for continuing iterating other modules for abstract type mappings.
Best regards
Asger Christiansen