You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "garydgregory (via GitHub)" <gi...@apache.org> on 2023/07/02 14:23:41 UTC

[GitHub] [commons-lang] garydgregory commented on a diff in pull request #1077: refactored ArrayUtils to reuse the getLength(Object array) method

garydgregory commented on code in PR #1077:
URL: https://github.com/apache/commons-lang/pull/1077#discussion_r1249551867


##########
src/main/java/org/apache/commons/lang3/ArrayUtils.java:
##########
@@ -655,7 +655,7 @@ private static Object add(final Object array, final int index, final Object elem
             Array.set(joinedArray, 0, element);
             return joinedArray;
         }
-        final int length = Array.getLength(array);
+        final int length = getLength(array);

Review Comment:
   -1: Why? `array` can't be null here.
   



##########
src/main/java/org/apache/commons/lang3/ArrayUtils.java:
##########
@@ -1668,7 +1668,7 @@ public static boolean containsAny(final Object[] array, final Object... objectsT
      */
     private static Object copyArrayGrow1(final Object array, final Class<?> newArrayComponentType) {
         if (array != null) {
-            final int arrayLength = Array.getLength(array);
+            final int arrayLength = getLength(array);

Review Comment:
   -1: Makes no sense since you're in a block where `array` can't be null.



-- 
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: issues-unsubscribe@commons.apache.org

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