-
Notifications
You must be signed in to change notification settings - Fork 175
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
@JsonAnySetter not working since 2.18, what is the correct usage? #832
Comments
@jacinpoz This might be due to: FasterXML/jackson-databind#4508 and if so, it'd be fixed for 2.18.1. If there is any chance you could try locally building and using Breakage in 2.18.0 was uncaught because it appears that:
|
@cowtowncoder Thank you for the very quick response! I have tested locally with jackson-databind 2.18.1 and it seems to work well when using Thanks again for the rapid reply, and I am looking forward to seeing 2.18.1 released. |
@jacinpoz for the benefit of others who find this bug, would you be willing to share the example code that works with 2.18.1-SNAPSHOT? |
Sure, it's just the exact same code as the one in my first example, but replacing
|
Your question
Since the upgrade to 2.18.0 from 2.17.2 our data classes constructor properties are not deserialized correctly.
See sample code below:
This test passes in 2.17.2, but in 2.18 the "anything" property in "anySetter" variable doesn't contain any entries in the map and therefore it throws a
java.util.NoSuchElementException
.Additionally, when we upgraded to 2.17, we had to change all references to
@JsonAnySetter
in our constructor properties to be@field:JsonAnySetter
as otherwise no json properties would be deserialized. Now none of these approaches in 2.18 work.What is the correct way of using @JsonAnySetter in constructor properties now?
PS: I also played with the @JsonCreator annotation given the contents of https://cowtowncoder.medium.com/jackson-2-18-rc1-overview-765e29a33371 , but it made no difference.
The text was updated successfully, but these errors were encountered: