Skip to content

@JsonProperty and equivalents should merge with AnnotationIntrospectorPair #4364

@cowtowncoder

Description

@cowtowncoder

Describe your Issue

If a property has multiple naming annotations -- such as standard @JsonProperty, and @JacksonXmlProperty from jackson-dataformat-xml -- and there are 2 AnnotationIntrospectors, then AnnotationIntrospectorPair should merge parts so that if the Primary introspector has no value (empty String or null), value from secondary should be used, for:

  1. Local name
  2. Namespace

so that, for example:

@JacksonXmlProperty(isAttribute=true)
@JsonProperty(namespace="uri:ns1", value="prop")
public int value;

where first annotation has precedence (annotation introspector that handles it is the first introspector configured for AnnotationIntrospectorPair) we should have localName and namespace from @JsonProperty since JacksonXmlProperty defines neither (that is, has defaults of "").
Currently this is not the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.17Issues planned at earliest for 2.17

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions