Java Code Examples for sun.reflect.misc.ReflectUtil#isPackageAccessible()

The following examples show how to use sun.reflect.misc.ReflectUtil#isPackageAccessible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Introspector.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null;
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 2
Source File: Introspector.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 3
Source File: Introspector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 4
Source File: Introspector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 5
Source File: Introspector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 6
Source File: Introspector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 7
Source File: Introspector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 8
Source File: Introspector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 9
Source File: Introspector.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 10
Source File: Introspector.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo;
    synchronized (declaredMethodCache) {
        beanInfo = context.getBeanInfo(beanClass);
    }
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        synchronized (declaredMethodCache) {
            context.putBeanInfo(beanClass, beanInfo);
        }
    }
    return beanInfo;
}
 
Example 11
Source File: Introspector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 12
Source File: Introspector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 13
Source File: Introspector.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 14
Source File: Introspector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 15
Source File: Introspector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 16
Source File: Introspector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 17
Source File: Introspector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 18
Source File: Introspector.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Introspect on a Java Bean and learn about all its properties, exposed
 * methods, and events.
 * <p>
 * If the BeanInfo class for a Java Bean has been previously Introspected
 * then the BeanInfo class is retrieved from the BeanInfo cache.
 *
 * @param beanClass  The bean class to be analyzed.
 * @return  A BeanInfo object describing the target bean.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 * @see #flushCaches
 * @see #flushFromCaches
 */
public static BeanInfo getBeanInfo(Class<?> beanClass)
    throws IntrospectionException
{
    if (!ReflectUtil.isPackageAccessible(beanClass)) {
        return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
    }
    ThreadGroupContext context = ThreadGroupContext.getContext();
    BeanInfo beanInfo = context.getBeanInfo(beanClass);
    if (beanInfo == null) {
        beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
        context.putBeanInfo(beanClass, beanInfo);
    }
    return beanInfo;
}
 
Example 19
Source File: Introspector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}
 
Example 20
Source File: Introspector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Method[] getPublicDeclaredMethods(Class<?> clz) {
    // Looking up Class.getDeclaredMethods is relatively expensive,
    // so we cache the results.
    if (!ReflectUtil.isPackageAccessible(clz)) {
        return new Method[0];
    }
    synchronized (declaredMethodCache) {
        Method[] result = declaredMethodCache.get(clz);
        if (result == null) {
            result = clz.getMethods();
            for (int i = 0; i < result.length; i++) {
                Method method = result[i];
                if (!method.getDeclaringClass().equals(clz)) {
                    result[i] = null; // ignore methods declared elsewhere
                }
                else {
                    try {
                        method = MethodFinder.findAccessibleMethod(method);
                        Class<?> type = method.getDeclaringClass();
                        result[i] = type.equals(clz) || type.isInterface()
                                ? method
                                : null; // ignore methods from superclasses
                    }
                    catch (NoSuchMethodException exception) {
                        // commented out because of 6976577
                        // result[i] = null; // ignore inaccessible methods
                    }
                }
            }
            declaredMethodCache.put(clz, result);
        }
        return result;
    }
}