Thanks to visit codestin.com
Credit goes to github.com

Skip to content

method.setAccessible(true) for methods in Object.class #1170

@sergiovanovi

Description

@sergiovanovi

Hi!

in this case you trying to set accessible to methods in Object.class
why?

For example, in class org.powermock.reflect.internal.WhiteboxImpl 1505 line
while (thisType != null) { final Class<?> type = thisType; final Method[] declaredMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { @Override public Method[] run() { return type.getDeclaredMethods(); } }); for (Method method : declaredMethods) { if(!"finalize".equals(method.getName())) { method.setAccessible(true); methods.add(method); } } Collections.addAll(methods, type.getMethods()); thisType = thisType.getSuperclass(); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions