You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by "Will-Lo (via GitHub)" <gi...@apache.org> on 2023/04/27 14:42:24 UTC

[GitHub] [gobblin] Will-Lo commented on a diff in pull request #3688: [GOBBLIN-1826] Change isAssignableFrom() to isSuperTypeOf() per Guava 20 javadocs to…

Will-Lo commented on code in PR #3688:
URL: https://github.com/apache/gobblin/pull/3688#discussion_r1179268362


##########
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegistrationUnit.java:
##########
@@ -125,14 +125,13 @@ protected void populateSerDeFields(State state) {
   protected static <T> Optional<T> populateField(State state, String key, TypeToken<T> token) {
     if (state.contains(key)) {
       Optional<T> fieldValue;
-
-      if (new TypeToken<Boolean>() {}.getRawType().isAssignableFrom(token.getClass())) {
+      if (new TypeToken<Boolean>(){}.isSupertypeOf(token)) {
         fieldValue = (Optional<T>) Optional.of(state.getPropAsBoolean(key));
-      } else if (new TypeToken<Integer>() {}.getRawType().isAssignableFrom(token.getClass())) {
+      } else if (new TypeToken<Integer>(){}.isSupertypeOf(token)) {
         fieldValue = (Optional<T>) Optional.of(state.getPropAsInt(key));
-      } else if (new TypeToken<Long>() {}.getRawType().isAssignableFrom(token.getClass())) {
+      } else if (new TypeToken<Long>(){}.isSupertypeOf(token)) {
         fieldValue = (Optional<T>) Optional.of(state.getPropAsLong(key));
-      } else if (new TypeToken<List<String>>() {}.getRawType().isAssignableFrom(token.getClass())) {

Review Comment:
   Yup that's what happened, shouldn't have taken the raw type unless I was also getting the raw type from the incoming token as well.



-- 
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: dev-unsubscribe@gobblin.apache.org

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