Files
openide/java/java-tests/testData/refactoring/extractMethodObject4Debugger/outs/methodWithParameter.out
T

44 lines
1.7 KiB
Plaintext

call text: Object result = new Test(instance).invoke();
class:
static class Test {
private WithReflectionAccess instance;
public Test(WithReflectionAccess instance) {
this.instance = instance;
}
public static Object callMethod1(Object object, WithReflectionAccess arg) {
try {
Class<?> klass = Class.forName("WithReflectionAccess");
java.lang.reflect.Method member = null;
int interfaceNumber = -1;
Class<?>[] interfaces = null;
while (member == null) {
try {
member = klass.getDeclaredMethod("method", Class.forName("WithReflectionAccess"));
} catch (ReflectiveOperationException e) {
if (interfaceNumber == -1) {
interfaces = klass.getInterfaces();
interfaceNumber = 0;
}
if (interfaceNumber < interfaces.length) {
klass = interfaces[interfaceNumber];
interfaceNumber += 1;
} else {
klass = klass.getSuperclass();
if (klass == null) throw e;
interfaceNumber = -1;
}
}
}
member.setAccessible(true);
return (Object) member.invoke(object, arg);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
public Object invoke() {
return callMethod1(instance, instance);
}
}