-
-
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
Jackson Upgrade 2.11.4 to 2.16.1: Base class field serialization/deserialization not working properly #4354
Comments
Though I am not sure whether the behavior change (if true) is intended or not, implementing
... methods instead of returning null might solve the error if that's what you are looking for. |
What would help here would be a minimal reproduction. Example as-is is unfortunately big too big as regression test. And yes, |
Adding code in the idFromValue() method fixed the issue. Although why it worked previously with null (in 2.11.4) and stopped working in the current version is not clear. There didn't seem to be any documentation around this for me to read up on. Anyways, thank you for suggesting the fix. |
As I said, we do not really know why it was seemingly working -- I don't think support was necessarily intentional, nor breakage. Would be good to find if this could be improved, but we still do not have small enough reproduction to really achieve that. But it is good you have a workaround. |
For what it is worth, returning |
Search before asking
Describe the bug
I upgraded jackson library in my codebase from 2.11.4 to 2.16.1 and the below test case that was working fine before is now failing. In one run I retained the JsonTypeInfo annotation and I get the following exception:
If I remove the @JsonTypeInfo annotation, the assert statement fails complaining that the deserilized MyAction object is not an instance of SendEmailAction class.
Any idea why this change in jackson behaviour?
Version Information
2.16.1 on Macbook Intel Ventura.
Reproduction
Code attached for reference:
This is the existing base class.
And this is the derived class that extends the MyAction class.
This is the ENUM class.
This is the resolver class.
And the test class that fails post the upgrade.
Expected behavior
There should be no problem in serializing just as before.
Object deserilized using MyAction.class is and should be an instance of SendEmailAction.class.
Additional context
No response
The text was updated successfully, but these errors were encountered: