-
-
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 annotation not honored for abstract types #795
Comments
Conversion into abstract type should be perfectly legal. I tried a simplified example which worked, so now I need to dig bit deeper to see why your case fails. |
Seems to be a problem with combination of Creator and converter, for what that is worth: if |
As to non-abstract type: it is possible it might work just because of existence of |
Ok. Turns out the fix was bit non-trivial, and it can only be done in master branch for 2.6. |
OK, thanks. Using a setter works around the issue for me, thanks. I will watch out for 2.6 release and re-test there. |
For me it's still not working in
where |
@riwnodennyk Ok. Could you file another issue, since root cause might be different? It will also be easier to keep release notes clean wrt release in which various issues were resolved. You can have a reference back to this issue from description. |
I have a use case (described also in this Stackoverflow question: http://stackoverflow.com/questions/30264115/how-to-use-jackson-deserializer-converter-correctly) where I would like to implement custom parsing for string values into types based on a legacy parser. I implemented a converter extending
StdConverter
that takes a string and runs my legacy parser to parse it in my desired type. I then tried to use@JsonDeserialize
withconverter
argument.This works when my field is a concrete class. But if my field is declared to be of an abstract type, even if the converter correctly returns a concrete instance, I get an exception.
More specifically, in the test case below, I would expect both
testNonAbstractTypeDeserialization
andtestAbstractTypeDeserialization
to pass, because they use very similar converters. But in practice (Jackson 2.5.0)testNonAbstractTypeDeserialization
passes, andtestAbstractTypeDeserialization
fails with the following exception:The JUnit test case is below
The text was updated successfully, but these errors were encountered: