You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/09/27 18:29:10 UTC

[GitHub] [commons-lang] verhas commented on a change in pull request #462: General Code Cleanup

verhas commented on a change in pull request #462: General Code Cleanup
URL: https://github.com/apache/commons-lang/pull/462#discussion_r329198861
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##########
 @@ -833,30 +833,28 @@ public static boolean isAssignable(Class<?> cls, final Class<?> toClass, final b
                 return Double.TYPE.equals(toClass);
             }
             if (Character.TYPE.equals(cls)) {
-                return Integer.TYPE.equals(toClass)
-                    || Long.TYPE.equals(toClass)
-                    || Float.TYPE.equals(toClass)
-                    || Double.TYPE.equals(toClass);
+                return isSomeNumberType(toClass);
             }
             if (Short.TYPE.equals(cls)) {
-                return Integer.TYPE.equals(toClass)
-                    || Long.TYPE.equals(toClass)
-                    || Float.TYPE.equals(toClass)
-                    || Double.TYPE.equals(toClass);
+                return isSomeNumberType(toClass);
             }
             if (Byte.TYPE.equals(cls)) {
                 return Short.TYPE.equals(toClass)
-                    || Integer.TYPE.equals(toClass)
-                    || Long.TYPE.equals(toClass)
-                    || Float.TYPE.equals(toClass)
-                    || Double.TYPE.equals(toClass);
+                    || isSomeNumberType(toClass);
             }
             // should never get here
             return false;
         }
         return toClass.isAssignableFrom(cls);
     }
 
+    private static boolean isSomeNumberType(Class<?> toClass) {
 
 Review comment:
   This is not an automatic fix. This code was copy-paste.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services