Skip to content

defaultImpl configuration is ignored for WRAPPER_OBJECT #656

@iovesnov

Description

@iovesnov

I am using using jackson version 2.4.4.

I was answering on one of the questions on the stackoverflow and found that 'defaultImpl' configuration is ignored if to use 'WRAPPER_OBJECT' include type. Code example:

@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include= JsonTypeInfo.As.WRAPPER_OBJECT, defaultImpl = UnknownProduct.class)

After some debugging I found that this specific include type (WRAPPER_OBJECT) ignoring the defaultImpl configuration. Here is a constructor of the AsWrapperTypeDeserializer which takes defaultImpl class as a parameter but then ignore it:

public AsWrapperTypeDeserializer(JavaType bt, TypeIdResolver idRes,
        String typePropertyName, boolean typeIdVisible, Class<?> defaultImpl)
{
    super(bt, idRes, typePropertyName, typeIdVisible, null);
}

Other include types are working fine (deserializers are passing defaultImpl configuration into the super clas constructor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions