-
-
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
External property polymorphic deserialization does not work with enums #1328
Comments
This one is odd, basically in the subclass of Then the |
So the bug is that the type of the polymorphic variable is coming in as Fails when databind code does the instantiation, and when I have the kotlin module do the same, it fails as well. Maybe only applies when |
You can test by running the Kotlin module after re-enabling the test in: |
I would need a Java-only reproduction here, since it sounds there's nothing Kotlin-specific about it. |
Or is this basically #1366? |
@apatrida (cc: @cowtowncoder ) I was not able to reproduce this in Java. Here is the java repro attempt: |
@rocketraman not sure, basically I receive a value of the wrong type (string) when it should be coerced to the enum value already. It could still be an issue with the StdValueInstantiator... i'll check it again. |
@cowtowncoder The issue is
and looking at the So something in the Looking at the method signature again... the
Great, those are correct. So why then does
Therefore |
Looking at the work from #1224 would help to figure out how to reproduce this from Java since there were test cases written for this @rocketraman |
And it goes deeper, whatever created the |
So the value passed into who's job is it to coerce the type from a string into an enum @cowtowncoder ? |
I can work around the issue by special casing |
@apatrida Ok hadn't noticed your second to last comment. I think I'd really need a smallish example to follow through, to know who is right, who wrong. |
I have the same issue(I think its an issue) after upgrading from 2.7.4 -> 2.8.6 in Java spring-boot project My json
|
Looking at this again now I realize that it is not clear whether type id is even expected to allow anything other than But I'll try to see if it'd be easy to make this work. It is not an unreasonable wish. |
@pmorixe Unfortunately I still don't see the issue here: no exception is thrown. What is the exact problem you see? Note that |
@apatrida Conversion to expected value of property should be done by |
Unfortunately can not reproduce at this point. May be re-opened/re-filed with Java reproduction. |
I also ran into this problem. I noticed that when it came time to call the all argument constructor if I set
Jackson would try to pass a
to the all args constructor. If I manually make the constructor with that annotation it fails if I remove it it works. Here is a code that demonstrates the problem:
This is using jackson 2.9.1 |
Lombok unfortunately is often part of a problem. It is possible here it is due to its adding But it is possible to disable latter part, by disabling
which might prevent the issue. |
Ah thanks that is useful to know. Yes it is due to the What should be done next? I think this is a bug. Would you like a new issue be created or should this be re-opened? |
@LukeButtersFunnelback How about I re-open it, given that there is a Java reproduction. |
Ok so this took a while. But I found the problem and fixed it for 2.9.6. As @apatrida pointed out earlier, value was of wrong type -- |
versions: Jackson 2.8.1, Jackson-module-kotlin 2.8.1
Attempting to deserialize a class using external_property. In my case, the property is an Enum type with values matching the type name. Now that issue #999 is fixed, I thought this would work, but now I'm getting a different error:
Here is the reproduction recipe: https://github.com/rocketraman/jackson-issue-enum-polymorphism/blob/master/src/main/kotlin/enumtype/Reproduction-KindEnum.kt
The text was updated successfully, but these errors were encountered: