get rid of intellij.build.toolbox.litegen parameter and use BuildOptions.TOOLBOX_LITE...
[idea/community.git] / java / java-tests / testData / refactoring / extractMethodObject4Debugger / outs / accessField.out
1 call text: new Test(instance).invoke();
2 class: 
3 static class Test {
4         private Object instance;
5
6         public Test(Object instance) {
7             this.instance = instance;
8         }
9
10         public static int accessToFieldField1(Object object, Object value) {
11             try {
12                 Class<?> klass = Class.forName("WithReflectionAccess");
13                 java.lang.reflect.Field member = null;
14                 int interfaceNumber = -1;
15                 Class<?>[] interfaces = null;
16                 while (member == null) {
17                     try {
18                         member = klass.getDeclaredField("field");
19                     } catch (ReflectiveOperationException e) {
20                         if (interfaceNumber == -1) {
21                             interfaces = klass.getInterfaces();
22                             interfaceNumber = 0;
23                         }
24                         if (interfaceNumber < interfaces.length) {
25                             klass = interfaces[interfaceNumber];
26                             interfaceNumber += 1;
27                         } else {
28                             klass = klass.getSuperclass();
29                             if (klass == null) throw e;
30                             interfaceNumber = -1;
31                         }
32                     }
33                 }
34                 member.setAccessible(true);
35                 return (int) member.get(object);
36             } catch (ReflectiveOperationException e) {
37                 throw new RuntimeException(e);
38             }
39         }
40
41         public void invoke() {
42             System.out.println(accessToFieldField1(instance, null));
43         }
44     }