-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
When deserialize call arg constructor or default constructor Specification changed? or bug? #2008
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
Comments
Specification has not changed, and setters, if any, should be called after constructor is called. |
This test do success until 2.9.1 2.9.1 be call default constructor and setter |
I am not sure I understand what the code is intended to do, but to me behavior in But here is how logic is intended to work:
The complexity in this case comes from various renaming annotations, which probably causes confusion of what should happen. Starting with From this we get implicit property names "etc", "name" and "age". In addition, there are fields and getters with matching implicit name. These get associated with constructor parameters. But getters also have explicit annotations (name overrides), which will be used to rename associated accessors, including constructor parameters. Finally, there are also setters, with explicit names "jacksonAge" and "jacksonName".
Since constructor parameter has the highest precedence, on deserialization, values get passed through it. No setter is called, no field assigned, since all properties are matched. Now: I don't know why behavior in 2.9.0 and 2.9.1 would behave differently. None of the fixes listed in As to intended behavior: I would need to understand what exactly you are trying to achieve, and we can probably get that to work with different annotations. For example, to prevent renaming, you can replace use of
which would prevent these from being renamed due to naming match with getter/setter/field. |
Also: quite probably related to: FasterXML/jackson-modules-java8#67 although not the same thing. Just likely related due to timing, same area of code (creator handling). |
Uh oh!
There was an error while loading. Please reload this page.
Hello.
sample code.
have @JsonIgnore annotation field
When deserialize I want call @JsonSetter after default constructor.
It was until 2.9.1
But didn't call @JsonSetter from 2.9.2
It specification changed? or bug?
Thank you
The text was updated successfully, but these errors were encountered: