-
-
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
Getter that returns an abstract collection breaks a delegating @JsonCreator
#2251
Comments
@2is10 thank you for reporting this: with quick glance this does seem like a bug: for deserialization, the highest precedence information should be constructor parameter which declares expected type of |
Ok. So, one thing I fixed first is that for some reason there were no fallback mappings for But I'll see if I can also find why type detection prefers |
Hmmh. Ok, so accessor problem comes via "setterless" property, which is concept wherein "getter" may be used as sort-of setter if nothing else is available. And since what we have here is delegating constructor (and NOT setter-based), there is attempt to find deserializer for theoretical use for property This is not optimal, but I don't think I can solve that for time being, so I will let the preliminary fix take care of short-term problem here. But I'll see if I can write a separate failing test for this problem. |
Created #2252 as followup for this issue. |
@JsonCreator
Thanks @cowtowncoder! Note: In my actual code, the abstract |
@2is10 Ok. Yes, I hope to solve that one still. And just in case it might help, there is the Or, I guess you could also register bogus custom deserializer, which similarly should never actually get called. Still, I hope I can fix #2252 itself in future. |
Using version 2.9.2 or 2.9.8 (and probably many other versions), the following test throws:
This is a spurious error since the
@JsonCreator
constructor only requiresCollection<Integer>
, notAbstractSet<Integer>
.Some workarounds:
getVals()
.getVals()
non-public.@JsonValue
togetVals()
.@JsonIgnore
togetVals()
.@JsonAutoDetect(getterVisibility = Visibility.NONE)
toValSet
.The text was updated successfully, but these errors were encountered: