Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.7.4
-
Fix Version/s: None
-
Component/s: Serializer
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
Currently if you serialize a Collection<T> where T is a polymorphic type (i.e. has a @JsonTypeInfo), the type information is not serialized out. This can be worked around by creating a typedWriter with a TypeReference<Collection<V>> (or at least it should, but it does not actually work currently - see JACKSON-543).
Ostensibly this is to ensure symmetry between serialization and deserialization - without the same type information available at deserialization time, this could fail. However to deserialize such a type you must already provide a TypeReference<Collection<V>> or some other way of explicitly mentioning the type, so it should be safe to infer this from the value class itself or some other mechanism.
Further discussion of this feature request, as well as a failing test case, is available in the comments of JACKSON-543.