jackson-datatypes-collections icon indicating copy to clipboard operation
jackson-datatypes-collections copied to clipboard

PrimitiveRefMapSerializer and RefPrimitiveMapSerializer don't extend ContainerSerializer

Open leventov opened this issue 4 years ago • 2 comments

ContainerSerializer (a class in jackson-databind) includes some non-trivial machinery which may change in any version of Jackson. PrimitiveRefMapSerializer and RefPrimitiveMapSerializer (in primitive_collections_base) duplicate some parts of that logic (and I'm not sure that they do it right). Therefore, I think it would be nice to refactor these classes to inherit from ContainerSerializer.

leventov avatar Oct 28 '19 07:10 leventov

In general, I agree. The only caveat is that for actual primitive value collections, there may be challenges: in databind separate PrimitiveArrayDeserializers<T> is used as base class, which does not extend ContainerDeserializerBase.

Also: let me know if I can help verifying handling -- it is certainly true that some cases are tricky and handling has evolved over time; even as recently as 2.9 with null handling (skip / fail / replace-with-empty) and merging. And that keeping up with those changes from datatype modules is challenging; yet users naturally expect feature parity (since it is sort of what datatype module approach tries to offer).

cowtowncoder avatar Oct 29 '19 05:10 cowtowncoder

I think that was my reason for not extending ContainerDeserializerBase, but from what I can tell ContainerSerializer is the base class for the primitive array serializers so at least that should be fine.

yawkat avatar Oct 29 '19 11:10 yawkat