-
-
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
Disabling FAIL_ON_INVALID_SUBTYPE
breaks polymorphic deserialization of Enums
#2775
Comments
This test works fine in 2.11 branch, what I do wrong? UPD: Sorry, I see, I just had to explicitly disable this feature |
Interesting. I can reproduce this. Workaround that trips handling appears to be fix for #148 so can not just remove use of |
Fundamentally the problem is that A solution here really is to use different inclusion: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_ARRAY) and things will work. It is odd that without disabling |
FAIL_ON_INVALID_SUBTYPE
breaks polymorphic deserialization of Enums
I was able to fix this, but since there is some risk in fix will only add in for 2.12.0 (probably in 2.12.0-rc2), not for earlier minor versions. I suspect risk simply because this affects edge cases and testing is probably not extensive for such cases. |
Apparently, disabling the FAIL_ON_INVALID_SUBTYPE feature has some (at least for me) unexpected side-effects on the deserialization of enums. I originally found this issue in jackson-databind 2.10.0, but it still exists in 2.11.0.
I have an enum that implements an interface:
Then, this test case works fine:
However, when I disable the feature, the test case fails because
deserializedValue
is suddenlynull
. The reason seems to be that aNullyfingDeserializer
is returned fromTypeDeserializerBase._findDefaultImplDeserializer(...)
instead ofnull
. Therefore, theAsPropertyDeserializer
no longer tries to read the value itself.The text was updated successfully, but these errors were encountered: