-
-
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
Converter called twice results in ClassCastException #1189
Comments
Could you please include stack trace for exception, as well as Jackson version you are using. |
Yes, good point. I am on jackson 2.6.5
|
Ok, I suspect that combination of polymorphic type handling, and forced subtype, combined with converter does not play well together. In fact I am not sure if, specifically, polymorphic subtype handling and converter can even be made to work together. |
Follow-up comment on above: I am not saying this won't work, just that it is not entirely surprising there may be issues. But I wonder if there was a way to simplify test to tease out the failure. |
The funny thing is that testConvert2 actually loads it polymorphically and |
@carrino agreed. |
Ok. In general case, I don't think combination of What I can change is the existing handling in case where both are used, in a way that Anyway; making the change should allow use of |
I'm not intimately familiar with the inner workings but I was hoping the Other option is we don't need to call the converter if the type is already
|
@carrino If the polymorphic type was related to type that was given to There may be cases where types are chosen in such a way that things would work, but as far as I can see this is not such case; and I don't like solutions that would sometimes work, other times not, depending on exact situation. |
I have a minimal repro below. testConverter fails with a class cast. The converter is called once on JsonNode and returns a SubClass. Then it is called again with that returned SubClass and fails.
testConverter2 passes.
The text was updated successfully, but these errors were encountered: