-
-
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
Non-generic interface method hides type resolution info from generic base class #1705
Comments
Ok. First of all, thank you for reporting this. I wouldn't be surprised if there were cases where refinement could lead to loss of typing, but should not. But one thing that is needed is to base this off of 2.9(.0.pr4). There have been quite significant changes in handling, and it is likely that fixes may only be safe enough to make for 2.9 at this point (since 2.8 patches extend to quite far, and once 2.9 is out, specifically, I want to minimize risk for 2.8 patches... have had some problems in this area lately :) ). So would it be possible to quickly verify that patch also works for 2.9.0.pr4? I hope to look into this, too, but I do have quite full a plate unfortunately. |
Sure thing. If there's been significant change, I'll first verify it's still causing me an issue with 2.9. And then if the fix still applies. FWIW The 2.8 test suite passes with my change. |
The same issue is present in 2.9.0.pr4. Looking now to see whether/where I can apply the fix. |
Fix is now in
becomes:
requiring The test suite continues to pass with this change. |
Seems reasonable, finally found time to add. Simplified test did not unfortunately verify the fail (probably since |
Thanks Tatu,
Yeah I was struggling with a test case as you know.
Cheers,
Tim
On Aug 23, 2017, at 1:48 PM, Tatu Saloranta <[email protected]<mailto:[email protected]>> wrote:
Seems reasonable, finally found time to add. Simplified test did not unfortunately verify the fail (probably since String is "natural" type, binds from java.lang.Object), so would be great to have a reproduction. But it seems like a proper fix.
Included in 2.9 for 2.9.1.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1705 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ADMGnHN6JeHTO5KhNcZvFzHwe_ISXJJHks5sbLo7gaJpZM4OaJ-B>.
|
@tbartley yes no problem, getting the fix is still most important here. |
Thanks for this @cowtowncoder, @tbartley Came across this issue today. |
Following on from sjz's comment above I have added a failing test to the commit comment referenced above. |
As per comment on commit, a new issue would be most welcome, and so I can fix it. |
Actually, since this was in 2.9.1, I can re-open, re-fix it without too much confusion... |
I saw this issue via MongoJack and haven't yet been able to construct a pure jackson databind test case but it seems that in some circumstances a class definition like the following:
can result in the type information required to resolve the type of
t
to a String is lost.This happens because in AnnotatedClass._addMemberMethods is this code:
In my test, the interface getter is discovered first and so plays the role of "old", then the base class getter is being added and so the original definintion of the method is simply adjusted with a reference to the method being processed. However the method from the interface has no type resolution information since the interface is not defined with generics so the type resolution information is lost and thus
t
can end up being serialialised as Object instead of String and so a serialisation failure occurs.I implemented a fix as follows. To AnnotatedMethod add the method:
and then change the code in AnnotatedClass to:
which resolved my problem. Happy to submit a pull request, but I haven't got the CLA ready yet and I would also like some help constructing a pure Jackson unit test to replicate the issue.
To be specific about my MongoJack reproducer:
Prints
{ "_id": "t" }
as expected with my fix and throws this exception without it:My testing has been using the 2.8 branch of jackson databind.
The text was updated successfully, but these errors were encountered: