Skip to content

Nulls property metadata ignored for creators #2458

@XakepSDK

Description

@XakepSDK

I'm using jackson databind 2.9.9.3.
I'm trying to deserialize object with creator. I've set

objectMapper.setDefaultSetterInfo(JsonSetter.Value.construct(Nulls.AS_EMPTY, Nulls.AS_EMPTY))

But jackson tries to put null instead of empty set in my constructor.

I debugged jackson and found, that jackson calls BasicDeserializerFactory#constructCreatorProperty to get constructor argument property(class CreatorProperty).
This class holds ProperyMetadata, which is used later to handle Nulls value.

PropertyMetadata constructed using PropertyMetadata.construct method (line 1066 in source code in IDE or https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java#L930 in current)

This call does not fill _valueNulls and _contentNulls. Looks like JsonSetter annotation and defaults are completely ignored for constructor arguments.

Is this intended? How can i prevent jackson from putting nulls in my contructor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions