You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/03/28 22:40:13 UTC

[GitHub] [druid] jimjoamz opened a new pull request #12373: Deprecated jackson fix

jimjoamz opened a new pull request #12373:
URL: https://github.com/apache/druid/pull/12373


   ### Description
   
   Druid uses deprecated Jackson methods `getGenericType`.  This method was deprecated in Jackson 2.7 and is dropped in Jackson 2.11
   
   This 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:
   - [x ] been self-reviewed.
   - [x ] been tested in a test Druid cluster.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] FrankChen021 commented on a change in pull request #12373: Deprecated jackson fix

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #12373:
URL: https://github.com/apache/druid/pull/12373#discussion_r838054221



##########
File path: core/src/main/java/org/apache/druid/guice/GuiceAnnotationIntrospector.java
##########
@@ -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());

Review comment:
       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.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jimjoamz commented on a change in pull request #12373: Deprecated jackson fix

Posted by GitBox <gi...@apache.org>.
jimjoamz commented on a change in pull request #12373:
URL: https://github.com/apache/druid/pull/12373#discussion_r840956906



##########
File path: core/src/main/java/org/apache/druid/guice/GuiceAnnotationIntrospector.java
##########
@@ -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());

Review comment:
       Sorry for the delay on getting back to you. 
   
   Oof yep I misread.  I will update this Pull Request!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jimjoamz commented on a change in pull request #12373: Deprecated jackson fix

Posted by GitBox <gi...@apache.org>.
jimjoamz commented on a change in pull request #12373:
URL: https://github.com/apache/druid/pull/12373#discussion_r837787995



##########
File path: core/src/main/java/org/apache/druid/guice/GuiceAnnotationIntrospector.java
##########
@@ -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());

Review comment:
       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+
   
   https://github.com/FasterXML/jackson-databind/blob/2.10/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java#L47-L49
   
   https://github.com/FasterXML/jackson-databind/blob/2.11/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java#L41-L47
   
   I can swap this to `getType()` instead if that is preferred.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] FrankChen021 commented on a change in pull request #12373: Deprecated jackson fix

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #12373:
URL: https://github.com/apache/druid/pull/12373#discussion_r836989594



##########
File path: core/src/main/java/org/apache/druid/guice/GuiceAnnotationIntrospector.java
##########
@@ -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());

Review comment:
       ``` java
       /**
        * 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.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org