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

[GitHub] [commons-lang] orionlibs opened a new pull request, #1077: refactored ArrayUtils to reuse the getLength(Object array) method

orionlibs opened a new pull request, #1077:
URL: https://github.com/apache/commons-lang/pull/1077

   refactored ArrayUtils to reuse the getLength(Object array) method inside the class instead of calling Array.getLength()


-- 
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


[GitHub] [commons-lang] orionlibs closed pull request #1077: refactored ArrayUtils to reuse the getLength(Object array) method

Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs closed pull request #1077: refactored ArrayUtils to reuse the getLength(Object array) method
URL: https://github.com/apache/commons-lang/pull/1077


-- 
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


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

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
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


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

Posted by "orionlibs (via GitHub)" <gi...@apache.org>.
orionlibs commented on code in PR #1077:
URL: https://github.com/apache/commons-lang/pull/1077#discussion_r1249553125


##########
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:
   just for code reuse. This class already has a getLength method. Why not reuse it inside this class? That was my thought. Not nulls. But it is OK. I will close it



-- 
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