code: public static Method[] getPublicMethods(Class<?> cls) {
          // compatibility for update release
          if (System.getSecurityManager() == null) {
              return cls.getMethods();
          }
          Map<Signature, Method> sigs = new HashMap<Signature, Method>();
          while (cls != null) {
              boolean done = getInternalPublicMethods(cls, sigs);
              if (done) {
                  break;
              }
              getInterfaceMethods(cls, sigs);
              cls = cls.getSuperclass();
          }
          return sigs.values().toArray(new Method[sigs.size()]);
      }
docs: /*
  Discover the public methods on public classes
  and interfaces accessible to any caller by calling
  Class.getMethods() and walking towards Object until
  we're done.