eric-milles commented on code in PR #2018:
URL: https://github.com/apache/groovy/pull/2018#discussion_r1434337876


##########
src/main/java/org/codehaus/groovy/reflection/CachedClass.java:
##########
@@ -282,14 +274,36 @@ public CachedMethod searchMethods(String name, 
CachedClass[] parameterTypes) {
         CachedMethod res = null;
         for (CachedMethod m : methods) {
             if (m.getName().equals(name)
-                    && ReflectionCache.arrayContentsEq(parameterTypes, 
m.getParameterTypes())
+                    && arrayContentsEq(parameterTypes, m.getParameterTypes())
                     && (res == null || 
res.getReturnType().isAssignableFrom(m.getReturnType())))
                 res = m;
         }
 
         return res;
     }
 
+    private static boolean arrayContentsEq(Object[] a1, Object[] a2) {
+        if (a1 == null) {
+            return a2 == null || a2.length == 0;
+        }
+
+        if (a2 == null) {
+            return a1.length == 0;
+        }
+
+        if (a1.length != a2.length) {
+            return false;
+        }
+
+        for (int i = 0; i < a1.length; i++) {
+            if (a1[i] != a2[i]) {
+                return false;
+            }
+        }
+
+        return true;
+    }

Review Comment:
   Is there a DGM or JVM method for this now?



-- 
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: notifications-unsubscr...@groovy.apache.org

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

Reply via email to