-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
DefaultScalaModule breaks deserialization of java classes #644
Comments
Please always provide the version of the jar you are using. A fix went in a while ago to stop this module accidentally affecting how Java classes are handled. |
Sorry, I tried with 2.13-2.14.1 and 2.13-2.15.2 with same results |
@pjfanning can you tell commit or pull request where this issue was fixed? I can't find anything like this since 2.15.2 released. |
The support for checking if classes are Scala classes and trying not to affect how Java classes are handled was added around v2.12.0 but has been adjusted a few times. When people raise issues, there is no guessing if they are using 10 year copies of the code or something up to date. Are you sure that your deserialization works if you don't add DefaultScalaModule? If you look at Jackson-Databind, support for Java Records has been very problematic. A big change was made in jackson-databind (v2.14.0, I think) that fixed a lot of issues but that broke a load more. Could you try not changing the jackson version and testing if registering DefaultScalaModule affects your deserialization? Your test in the description registers the DefaultScalaModule in its only test case so that proves nothing. |
As I write earlier I tried latest stable version of jackson (2.15.2) this code still doesn't work. Also I tried to remove records completely from code and it's still doesn't work. Removing DefaultScalaModule from ObjectMapper fixes test. |
I'm failing to reproduce this issue. I have a PR with a test that passes. #645 |
The changes ran for me locally but are failing to compile on the CI run. I'll look into those later. |
@kudrevatykh which Scala version are using? It seems that older Scala versions cannot deal with Java records. Could you trying using Scala 2.13.11? Scala 3.x may not yet support Java records either. |
I used 2.13.8, updating to 2.13.11 doesn't help too |
I commited full example without records and with latest jackson and scala https://github.com/kudrevatykh/scala-jackson-test |
I would recommend not using the DefaultScalaModule in your case. There are no patch releases planned in the near future so even if this module is changed, it could be a while till the next release. This issue is not a high priority for me. |
#646 fixes the issue. I have published a 2.16.0-SNAPSHOT jar with the fix. |
Great news, thanks |
I found problem that adding DefaultScalaModule to object mapper breaks Deserialization of classes that successfuly deserialized without scala module
The text was updated successfully, but these errors were encountered: