Debian Codegraph @

test/harness/java9/jpype/method/Caller.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package jpype.method;
17
18 import jdk.internal.reflect.CallerSensitive;
19
20 /**
21 * Caller sensitive methods need special handling.
22 *
23 * So we need to test each possible path (different return types and arguments).
24 *
25 * We will pretend our methods are also CallerSensitive.
26 */
27 public class Caller
28 {
29
30 @CallerSensitive
31 public static Object callObjectStatic()
32 {
33 return new Caller();
34 }
35
36 @CallerSensitive
37 public Object callObjectMember()
38 {
39 return new Caller();
40 }
41
42 @CallerSensitive
43 public static void callVoidStatic()
44 {
45 }
46
47 @CallerSensitive
48 public void callVoidMember()
49 {
50 }
51
52 @CallerSensitive
53 public static int callIntegerStatic()
54 {
55 return 123;
56 }
57
58 @CallerSensitive
59 public int callIntegerMember()
60 {
61 return 123;
62 }
63
64 @CallerSensitive
65 public Object callArgs(Object a, Object b)
66 {
67 return b;
68 }
69
70 @CallerSensitive
71 public int callArg1(int a)
72 {
73 return a;
74 }
75
76 @CallerSensitive
77 public Object callVarArgs(Object a, Object... b)
78 {
79 return b;
80 }
81
82 public Class callStackWalker1()
83 {
84 return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
85 }
86
87 @CallerSensitive
88 public Class callStackWalker2()
89 {
90 return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
91 }
92
93 };