code: public static Method getMethod(Class<?> cl, Method method) {
  
          if (method == null) {
              return null;
          }
  
          if (Modifier.isPublic(cl.getModifiers())) {
              return method;
          }
          Class<?> [] interfaces = cl.getInterfaces ();
          for (int i = 0; i < interfaces.length; i++) {
              Class<?> c = interfaces[i];
              Method m = null;
              try {
                  m = c.getMethod(method.getName(), method.getParameterTypes());
                  c = m.getDeclaringClass();
                  if ((m = getMethod(c, m)) != null)
                      return m;
              } catch (NoSuchMethodException ex) {
              }
          }
          Class<?> c = cl.getSuperclass();
          if (c != null) {
              Method m = null;
              try {
                  m = c.getMethod(method.getName(), method.getParameterTypes());
                  c = m.getDeclaringClass();
                  if ((m = getMethod(c, m)) != null)
                      return m;
              } catch (NoSuchMethodException ex) {
              }
          }
          return null;
      }
docs: /*
  Get a public method form a public class or interface of a given method.
  Note that if a PropertyDescriptor is obtained for a non-public class that
  implements a public interface, the read/write methods will be for the
  class, and therefore inaccessible.  To correct this, a version of the
  same method must be found in a superclass or interface.