Skip to content

@JsonProperty in @JsonCreator is conflicting with POJOs getters/attributes @JsonProperty - used to work with 1.9.11 #541

@fabienrenaud

Description

@fabienrenaud

Note: See my second post below for the actual problem and repro.

Example of POJO:

class Foo {
    @JsonProperty("s")
    private String str;

    Foo() {

    }

    Foo(String s) {
        this.str = str;
    }

    public String getStr() {
        return str;
    }
}

and this doesn't help:

        mapper.disable(
            MapperFeature.AUTO_DETECT_CREATORS,
            MapperFeature.AUTO_DETECT_FIELDS,
            MapperFeature.AUTO_DETECT_GETTERS,
            MapperFeature.AUTO_DETECT_IS_GETTERS,
            MapperFeature.AUTO_DETECT_SETTERS,
            MapperFeature.USE_GETTERS_AS_SETTERS
        );

Even disabling DEFAULT_VIEW_INCLUSION doesn't help.

Give an exception like:
java.lang.IllegalStateException: Conflicting/ambiguous property name definitions (implicit name 'rewards'): found multiple explicit names: [s, str], but also implicit accessor: [method Foo#getStr(0 params)][visible=true,ignore=false,explicitName=false]

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