question: @ Nullable public static Method findNonPublicMethod ( Class < ? > cls , String name , Class < ? > ... paramTypes ) { while ( cls != null ) { try { Method mtd = cls . getDeclaredMethod ( name , paramTypes ) ; if ( mtd . getReturnType ( ) != void . class ) { mtd . setAccessible ( true ) ; return mtd ; } } catch ( NoSuchMethodException ignored ) { } cls = cls . getSuperclass ( ) ; } return null ; }
target:  Finds a method in the class and it parents. Method.getMethod() does not return non-public method, Method.getDeclaratedMethod() does not look at parent classes.