-
-
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
Generic class with generic field of runtime type Double
is deserialized as BigDecimal
when used with @JsonTypeInfo
and JsonTypeInfo.As.EXISTING_PROPERTY
#3251
Comments
I wonder if this might be related to: which will be fixed for 2.12.5, to be released later today. |
@cowtowncoder I just stumbled across what seems to be a connected issue with version ProblemDeserializing JSON with floating point numbers will incorrectly use With sub typeClass definitions
JSON string to deserialize
ResultHydrated Without sub typeClass definition
JSON string to deserialize
ResultHydrated |
@richturner Could you please file a new with reproduction and information? I cannot say with 100% certainty this is directly intentional but I do think fix "should stick". Adding a test against regression makes sense, so issue can say that ("Add test to verify that ..."). In fact if you had time and interest, providing a unit test as PR would be most appreciated. But even just issue including what you said here would be useful. |
@pjfanning I suspect fixes to lazy parsing of floating-point values might be the thing for issue reported by @richturner. I wonder if this issue might be resolved as well -- I hope to find time to create a unit test for this (unless @JooHyukKim beats me to it :) ). |
I've created #4138 not sure I have much time to do a PR for this but hopefully this will help and may allow you to close a couple of issues in the process. |
Double
is deserialized as BigDecimal
when used with @JsonTypeInfo
and JsonTypeInfo.As.EXISTING_PROPERTY
Ok I added test via #4139 and this issue has been fixed. I suspect it would have been fixed in 2.15.0 already, but will mark as 2.16.0 as that's where test is added. |
Describe the bug
Bug appears when deserializing a generic class with a generic field with runtime type double, and the generic class
is annotated with @JsonTypeInfo with @JsonTypeInfo with JsonTypeInfo.As.EXISTING_PROPERTY.
The bug does not occur when using @JsonTypeInfo with JsonTypeInfo.As.PROPERTY.
Version information
To Reproduce
Test with 1 succeeding and 1 failing case, expecting both to succeed.
Additional context
This bug started happening when upgrading Spring Boot from 2.4.1 to 2.5.3.
As we don't manage Jackson version ourselves, Jackson was upgraded to 2.12.4,
I have not tried to reproduce this issue with a project that has only Jackson dependencies, managed
by jackson BOM 2.12.4.
The text was updated successfully, but these errors were encountered: