Debian Codegraph @

test/harness/jpype/overloads/Test1.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.overloads;
17
18 import java.util.List;
19
20 public class Test1
21 {
22
23 public static class A
24 {
25 }
26
27 public static class B extends A
28 {
29 }
30
31 public static class C extends B
32 {
33 }
34
35 public String testMostSpecific(A a)
36 {
37 return "A";
38 }
39
40 public String testMostSpecific(B b)
41 {
42 return "B";
43 }
44
45 public String testVarArgs(A a, A... as)
46 {
47 return "A,A...";
48 }
49
50 public String testVarArgs(A a, B... bs)
51 {
52 return "A,B...";
53 }
54
55 public String testVarArgs(B a, B... bs)
56 {
57 return "B,B...";
58 }
59
60 public String testPrimitive(byte v)
61 {
62 return "byte";
63 }
64
65 public String testPrimitive(Byte v)
66 {
67 return "Byte";
68 }
69
70 public String testPrimitive(short v)
71 {
72 return "short";
73 }
74
75 public String testPrimitive(Short v)
76 {
77 return "Short";
78 }
79
80 public String testPrimitive(int v)
81 {
82 return "int";
83 }
84
85 public String testPrimitive(Integer v)
86 {
87 return "Integer";
88 }
89
90 public String testPrimitive(long v)
91 {
92 return "long";
93 }
94
95 public String testPrimitive(Long v)
96 {
97 return "Long";
98 }
99
100 public String testPrimitive(float v)
101 {
102 return "float";
103 }
104
105 public String testPrimitive(Float v)
106 {
107 return "Float";
108 }
109
110 public String testPrimitive(double v)
111 {
112 return "double";
113 }
114
115 public String testPrimitive(Double v)
116 {
117 return "Double";
118 }
119
120 public String testPrimitive(boolean v)
121 {
122 return "boolean";
123 }
124
125 public String testPrimitive(Boolean v)
126 {
127 return "Boolean";
128 }
129
130 public String testPrimitive(char v)
131 {
132 return "char";
133 }
134
135 public String testPrimitive(Character v)
136 {
137 return "Character";
138 }
139
140 public static String testInstanceVsClass(B b)
141 {
142 return "static B";
143 }
144
145 public String testInstanceVsClass(A a)
146 {
147 return "instance A";
148 }
149
150 public static String testJavaInstanceVsClass()
151 {
152 return new Test1().testInstanceVsClass(new C());
153 }
154
155 /*
156 I1
157 / \
158 I2 I3
159 \ / \
160 I4 I5
161 | \ |
162 I6 I7
163 \ |
164 I8
165 */
166 public static interface I1
167 {
168 }
169
170 public static interface I2 extends I1
171 {
172 }
173
174 public static interface I3 extends I1
175 {
176 }
177
178 public static interface I4 extends I2, I3
179 {
180 }
181
182 public static interface I5 extends I3
183 {
184 }
185
186 public static interface I6 extends I4
187 {
188 }
189
190 public static interface I7 extends I4, I5
191 {
192 }
193
194 public static interface I8 extends I6, I7
195 {
196 }
197
198 public static class I1Impl implements I1
199 {
200 }
201
202 public static class I2Impl implements I2
203 {
204 }
205
206 public static class I3Impl implements I3
207 {
208 }
209
210 public static class I4Impl implements I4
211 {
212 }
213
214 public static class I5Impl implements I5
215 {
216 }
217
218 public static class I6Impl implements I6
219 {
220 }
221
222 public static class I7Impl implements I7
223 {
224 }
225
226 public static class I8Impl implements I8
227 {
228 }
229
230 public String testInterfaces1(I2 v)
231 {
232 return "I2";
233 }
234
235 public String testInterfaces1(I3 v)
236 {
237 return "I3";
238 }
239
240 public String testInterfaces2(I2 v)
241 {
242 return "I2";
243 }
244
245 public String testInterfaces2(I3 v)
246 {
247 return "I3";
248 }
249
250 public String testInterfaces2(I4 v)
251 {
252 return "I4";
253 }
254
255 public String testInterfaces3(I4 v)
256 {
257 return "I4";
258 }
259
260 public String testInterfaces3(I5 v)
261 {
262 return "I5";
263 }
264
265 public String testInterfaces4(I1 v)
266 {
267 return "I1";
268 }
269
270 public String testInterfaces4(I2 v)
271 {
272 return "I2";
273 }
274
275 public String testInterfaces4(I3 v)
276 {
277 return "I3";
278 }
279
280 public String testInterfaces4(I4 v)
281 {
282 return "I4";
283 }
284
285 public String testInterfaces4(I5 v)
286 {
287 return "I5";
288 }
289
290 public String testInterfaces4(I6 v)
291 {
292 return "I6";
293 }
294
295 public String testInterfaces4(I7 v)
296 {
297 return "I7";
298 }
299
300 public String testInterfaces4(I8 v)
301 {
302 return "I8";
303 }
304
305 public String testClassVsObject(Object v)
306 {
307 return "Object";
308 }
309
310 public String testClassVsObject(Class v)
311 {
312 return "Class";
313 }
314
315 public String testStringArray(Object v)
316 {
317 return "Object";
318 }
319
320 public String testStringArray(String v)
321 {
322 return "String";
323 }
324
325 public String testStringArray(String[] v)
326 {
327 return "String[]";
328 }
329
330 public String testListVSArray(String[] v)
331 {
332 return "String[]";
333 }
334
335 public String testListVSArray(List<String> v)
336 {
337 return "List<String>";
338 }
339
340 /* tests for java 1.8 default methods, commented out for travis environment
341 public interface IDefaultA {
342 public default String defaultMethod() {
343 return "A";
344 }
345 }
346 public interface IDefaultB extends IDefaultA {
347 public default String defaultMethod() {
348 return "B";
349 }
350 }
351 public interface IDefaultC extends IDefaultA, IDefaultB {
352 }
353 public static class DefaultC implements IDefaultC {
354 }
355 //*/
356 }