mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
(cherry picked from commit bbe83739e3db7cd0b7a4b8842b6e5c1cbb8d1f32) IJ-CR-161068 GitOrigin-RevId: a25b07b6d494e07c5bc018f5a6922b9bb4ad7978
44 lines
1.6 KiB
Plaintext
44 lines
1.6 KiB
Plaintext
call text: Object result = new Test(instance).invoke();
|
|
class:
|
|
public class GeneratedEvaluationClass {
|
|
private Object instance;
|
|
|
|
public GeneratedEvaluationClass(Object instance) {
|
|
this.instance = instance;
|
|
}
|
|
|
|
public static Object callMethod1(Object object, Object p0) {
|
|
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, p0);
|
|
} catch (ReflectiveOperationException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
public Object invoke() {
|
|
return callMethod1(instance, instance);
|
|
}
|
|
} |