Method[] m = superclass.getDeclaredMethods(); methods.add(m); size += m.length; superclass = superclass.getSuperclass();
try { Method[] m = superclass.getDeclaredMethods(); methods.add(m); size += m.length; superclass = superclass.getSuperclass(); } catch(SecurityException e) {    if(log.isWarnEnabled()) log.warn("unable to enumerate methods of superclass "+superclass+" of class "+target); superclass=null; }
    Method[] getAllMethods(Class target) {        Class superclass = target;        List methods = new ArrayList();        int size = 0;        while(superclass != null) {            Method[] m = superclass.getDeclaredMethods();            methods.add(m);            size += m.length;            superclass = superclass.getSuperclass();        }        Method[] result = new Method[size];        int index = 0;        for(Iterator i = methods.iterator(); i.hasNext();) {            Method[] m = (Method[])i.next();            System.arraycopy(m, 0, result, index, m.length);            index += m.length;        }        return result;    }