-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Deprecated jackson fix #12373
Deprecated jackson fix #12373
Conversation
…ethods * getGenericType is removed completely in Jackson 2.11 * This fix allows Druid to compile with Jackson 2.12+ as well as for existing distributions to replace version 2.10 with 2.12 at runtime.
@@ -58,9 +58,9 @@ public Object findInjectableValueId(AnnotatedMember m) | |||
if (m instanceof AnnotatedMethod) { | |||
throw new IAE("Annotated methods don't work very well yet..."); | |||
} | |||
return Key.get(m.getGenericType()); | |||
return Key.get(m.getRawType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**
* JDK declared generic type of the annotated element; definition
* of what exactly this means depends on sub-class. Note that such type
* cannot be reliably resolved without {@link TypeResolutionContext}, and
* as a result use of this method was deprecated in Jackson 2.7: see
* {@link #getType} for replacement.
*
* @deprecated Since 2.7 should instead use {@link #getType()}. To be removed from 2.9
*/
I'm a little confused that the javadoc indicates that getType
should be used as a replacement, and current getGenericType
calls getRawType()
internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good catch. Here's some more confusion for the pile. getType
was marked deprecated in 2.10 as well but seems to be un-deprecated in 2.11+
I can swap this to getType()
instead if that is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see that getType
was marked deprecated in 2.10 from the link above. Instead public final JavaType getType(TypeBindings bogus)
was marked deprecated.
IMO, it's better to follow the javadoc the replace the deprecated API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on getting back to you.
Oof yep I misread. I will update this Pull Request!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the Javadoc recommendation doesn't work the same and getRawType
is what we want here.
I'm working on getting tests building locally, I was using JDK17 which I see is a no-no in the build instructions. Sorry for the churn on this. Are you okay with pulling 671c984 as is?
This pull request has been marked as stale due to 60 days of inactivity. |
This pull request/issue has been closed due to lack of activity. If you think that |
Description
Druid uses deprecated Jackson methods
getGenericType
. This method was deprecated in Jackson 2.7 and is dropped in Jackson 2.11This PR allows any version of Druid built with Jackson 2.10 to be able to run against more recent versions of Jackson in its classpath
This PR also allows Druid to build against both Jackson 2.10 and Jackson 2.12, setting it up to migrate should any Jackson security issues be exposed in older version.
This PR has: