You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "stefanseifert (via GitHub)" <gi...@apache.org> on 2023/05/10 08:57:20 UTC

[GitHub] [sling-org-apache-sling-testing-osgi-mock] stefanseifert commented on a diff in pull request #26: SLING-11860 OsgiServiceUtil may invoke the wrong method

stefanseifert commented on code in PR #26:
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/26#discussion_r1189541679


##########
core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java:
##########
@@ -135,6 +136,35 @@ public static boolean modified(Object target, MockComponentContext componentCont
                 + " found in class " + targetClass.getName());
     }
 
+    /**
+     * SLING-11860 - find the nearest match.  First find any match in the class itself.
+     *     If none is found, then walk up the ancestor super classes to look for a match
+     *
+     * @param targetClass the class to start from
+     * @param fn the function to find and invoke the method
+     * @return the found method or null if not found
+     */
+    private static boolean findAndInvokeNearestMethod(Class<?> targetClass, Predicate<Class<?>> fn) {

Review Comment:
   the method name is misleading ad it finds methods, but does not invoke them



-- 
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@sling.apache.org

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