-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Disabling FAIL_ON_INVALID_SUBTYPE breaks deserialization in an edge case with generics + custom (de)serializers #2933
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
Comments
Quick note: there is also |
Your assumption is indeed correct - I confirm that the test also fails with I'm happy to have a poke about to try and investigate a fix if you could suggest where in the code the bug is likely to be (and then I can start debugging where the logic diverges between the 2 cases) ? |
Just realized that #2775 may be related: fix was added since 2.12.0-rc1. Otherwise assuming things are not working, maybe looking at commits for fix in #2775 may help. |
Passes for me, with latest 2.12 snapshot (that is, cannot reproduce). |
I updated my test case to use 2.12.0-SNAPSHOT from the Sonatype repo (https://oss.sonatype.org/content/repositories/snapshots), whose MANIFEST.MF says ..
but I still get the same failure? Do I need to wait for a more recent snapshot build? |
Latest snapshot is not 2.12.0-SNAPSHOT but 2.12.0-rc2-SNAPSHOT, so that is the difference here. |
Right - yes, I confirm it's fixed with the |
@stevestorey thank you for verifying this! |
Describe the bug
Disabling FAIL_ON_INVALID_SUBTYPE can cause deserialization (involving generic types) to fail, in such a way that values that were previously deserialized correctly when the feature is enabled get converted to
null
when the feature is disabled.My reading is that the feature should control whether an exception is thrown, or whether null is returned?
but in this case, the type resolution is working fine with the feature enabled, but returns nulls when it's disabled which seems to break the docs (and seems likely that it's a bug)
Version information
Tests fail with all of 2.10.2, 2.11.3, 2.11.4-SNAPSHOT
To Reproduce
Standalone test case:
Expected behavior
Both tests pass
Additional context
I expect that there are several things that are cotributing to the issue, not least the use of the custom serializers. Our 'real' code example is trying to (de)serialize ID types as scalar types based on string prefixes, and we occasionally want to use such
WrappedId
types in generic types some of which require generic type information to be included in the JSON.The text was updated successfully, but these errors were encountered: