-
-
Couldn't load subscription status.
- Fork 1.4k
Description
On this line within BasicDeserializerFactory#constructCreatorProperty, we create a Deserializer based on an annotation:
JsonDeserializer<Object> deser = findDeserializerFromAnnotation(ctxt, param);
... // lines that do not reference "deser"
if (deser != null) {
prop = prop.withValueDeserializer(deser);
}(source)
findDeserializerFromAnnotation will resolve, but not contextualize, the resulting Deserializer. Subsequently, in PropertyBasedCreator#construct, we will construct a contextualized Deserializer if and only if a Deserializer is not already present:
if (!prop.hasValueDeserializer()) {
prop = prop.withValueDeserializer(ctxt.findContextualValueDeserializer(prop.getType(), prop));
}(source)
However, this returns false because we do have a value deserializer.
Finally, we attempt to deserialize using this PropertyBasedCreator, within BeanDeserializer#_deserializeUsingPropertyBased:
Object value = creatorProp.deserialize(jp, ctxt);(source)
This fails, however, as our Deserializer was never contextualized.
If this is indeed a bug, I think a simple fix may be to simply contextualize the Deserializer within PropertyBasedCreator#construct if it's present. Let me know if that is a good solution; I can make a PR if desired.