Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jackson-module-parameter-names: @JsonPropertyName still required if @JsonDeserialize is used #178

Closed
clo-vis opened this issue Jun 25, 2020 · 5 comments
Milestone

Comments

@clo-vis
Copy link

clo-vis commented Jun 25, 2020

If ParameterNamesModule is registered, { "a": 1, "b": 1 } can be deserialized to an instance of:

public class Foo{
     public Foo(int a, int b) { }
}

but not to an instance of:

public class Foo{
    public Foo(@JsonDeserialize(converter=Incr.class) int a, int b) { }
}

unless you declare the property name again:

public class Foo{
     public Foo(@JsonDeserialize(converter=Incr.class)@JsonProperty("a") int a, int b) { }
}
@cowtowncoder
Copy link
Member

Interesting. Sounds like a flaw.

@cowtowncoder cowtowncoder added 2.12 hacktoberfest Issue related to Hactoberfest2020 activities, eligible for additional rewards labels Oct 20, 2020
cowtowncoder added a commit that referenced this issue Oct 20, 2020
@cowtowncoder
Copy link
Member

Can reproduce the issue; added a failing test.

@cowtowncoder
Copy link
Member

Ah. I think I know the root cause: existence of a few "well-known" annotation triggers equivalent of returning empty String for name for (de)serialization -- meaning "use default". But I think creator detection logic does not realize this (as it is abstracted behind AnnotationIntrospector)... and that needs to change, somehow. Fix needs to be in jackson-databind, but issue can be here for now.

@cowtowncoder
Copy link
Member

Created FasterXML/jackson-databind#2932 -- unlikely to be resolved for 2.12, hope to address in 2.13.

@cowtowncoder cowtowncoder removed the hacktoberfest Issue related to Hactoberfest2020 activities, eligible for additional rewards label Sep 24, 2022
@cowtowncoder
Copy link
Member

Was fixed in jackson-databind 2.12.0, actually.

@cowtowncoder cowtowncoder added this to the 2.12.0 milestone Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants