-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
Setter confusion on assignable types #158
Comments
Hmmh. No, this case should work just fine; introspection functionality should be able to resolve it even if visibility was not changed, to choose the explicit setter over non-annotated one. I'll see if I can reproduce your issue locally. |
Thanks for the fast response ctc. It seems to go wrong right here - as Serializable is assignable from String, so it thinks it's the same (or similar enough) method....
all this happens in AnnotatedClass.addMemberMethods, before any annotations are considered. |
For me that test passes without problems, on Which version are you having problems with? |
On latest release:
A more complete test...
Test...
Result...
My workaround...
|
Actually looks like I can sometimes reproduce this: order of methods as returned by reflection is what causes or hides the issue. So I think I should be able to figure out why overriding handling does not work as expected. |
@tsquared2763 Yes, you were absolutely correct on root cause. I can't recall the original reasoning, but equality really should not be extended that way, at this point in processing. Overlaps/conflicts will be properly resolved where possible at a later point; at this point identity must be preserved. Fixed for 2.4.4 (and 2.5) |
Thank you Tatu. Sent with AquaMail for Android On October 14, 2014 2:52:59 PM Tatu Saloranta [email protected] wrote:
|
I'm running into a problem where multiple setters with assignable arguments cause confusion in handling annotations. Consider:
I would expect to be able to marshall to/from Json using the annotated methods, but what happens is that (somewhat randomly based on the reflection iteration) I may get the setBar(Serializable) method mapped to the deserializer, which of course fails as an abstract mutator. Both methods occupy the same slot in the properties list during parser initialization.
The source of the problem seems to be at the following location - including foreshadowing comment by tatu on April 7 2009.. it didn't work for me sadly.
Looking for workaround ideas, other than 'don't do that'. Any way I can kick the setBar(Serialiazable) out of the list before the properties are created? Setting @JsonIgnore is too late unfortunately, the method list is already created when that is considered.
In com.fasterxml.jackson.databind.introspect.MemberKey.java
The text was updated successfully, but these errors were encountered: