-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Inconsistent behaviour with nulls for records #3847
Comments
Here's a simple project replicating it. |
You can inspect the zip without running it if you have security concerns.
Best,
João
…On Wed, 29 Mar 2023, 04:35 Kim, Joo Hyuk, ***@***.***> wrote:
Here's a simple project replicating it.
test2.zip
<https://github.com/FasterXML/jackson-databind/files/11092234/test2.zip>
can you post github link instead and delete comment with zip file link?
For security concerns.
—
Reply to this email directly, view it on GitHub
<#3847 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ44FSDEFPYGPWZLSXWBU3W6ONYZANCNFSM6AAAAAAWKGHJVI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@joca-bt From the attached project, I see that you're using version You can verify this by testing with com.fasterxml.jackson.core:jackson-databind:2.15.0-rc2 (don't forget to also upgrade any other Jackson dependency to the same version, to avoid any unnecessary problems). |
@joca-bt if you are able to verify this against 2.15.0-rc2 please let us know so I can close this (or keep open if issue remains). |
I can test it in the weekend. Where can I get the snapshot jar from? |
@joca-bt Not snapshot, pre-release candidate ( |
Ran the test cases in the zip I shared against 2.15.0-rc:
Overall, there are still some issues with records. |
Right I totally missed the Actually your
...is actually equivalent to:
...which when fed with empty hash The javadoc for Nulls & JsonSetter both mentioned "explicit |
@yihtserns Missing value (absent) is generally differently handled from explicit |
I think this issue probably needs to be broken up into separate ones, targeting what is not apparently working with 2.15.0-rc2. |
Created #3870 for "fail explicit null + constructor creator + absent value = |
Just to repeat myself, a Class equivalent of Record is not one with setter, but this:
(There were some behavioural discrepancies between a Class with constructor creator vs Records, but they are now mostly aligned in ...which will have this behaviour:
Knowing that, this issue is really about the behavioural difference between a POJO with constructor creator vs setter, i.e. #3870. |
Forbidding nulls works correctly with classes but doesn't with records. Moreover, the behaviour with records changes if we use @JsonProperty.
Let's take the following ObjectMapper definition:
When testing nulls with a class everything works as expected:
When testing the same class but adding @JsonProperty to it everything still works as expected:
When testing nulls with a record null hating doesn't seem to be working:
When testing the same record but adding @JsonProperty to it null hating starts working but something else breaks:
The text was updated successfully, but these errors were encountered: