Debian Codegraph @

test/harness/jpype/types/VirtualTest.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.types;
17
18 public class VirtualTest
19 {
20
21 public interface ObjectSupplier
22 {
23
24 Object get();
25 }
26
27 public static class ClassObjectSupplier implements ObjectSupplier
28 {
29
30 public Object get()
31 {
32 return "implements";
33 }
34 }
35
36 public static class ClassObjectSupplier2 extends ClassObjectSupplier
37 {
38
39 public Object get()
40 {
41 return "extends";
42 }
43 }
44
45 public static ObjectSupplier getObjectImplements()
46 {
47 return new ClassObjectSupplier();
48 }
49
50 public static ObjectSupplier getObjectExtends()
51 {
52 return new ClassObjectSupplier2();
53 }
54
55 public static ObjectSupplier getObjectAnon()
56 {
57 return new ObjectSupplier()
58 {
59 public Object get()
60 {
61 return "anon";
62 }
63 };
64 }
65
66 public static ObjectSupplier getObjectAnonExtends()
67 {
68 return new ClassObjectSupplier()
69 {
70 public Object get()
71 {
72 return "anon-override";
73 }
74 };
75 }
76
77 // This one has to wait for us to abandon Java 7
78 // public static ObjectSupplier getLambda()
79 // {
80 // return () -> "lambda";
81 // }
82 //<editor-fold desc="int" defaultstate="collapsed">
83 public interface IntegerSupplier
84 {
85
86 int get();
87 }
88
89 public static class ClassIntegerSupplier implements IntegerSupplier
90 {
91
92 public int get()
93 {
94 return 1;
95 }
96 }
97
98 public static class ClassIntegerSupplier2 extends ClassIntegerSupplier
99 {
100
101 public int get()
102 {
103 return 2;
104 }
105 }
106
107 public static IntegerSupplier getIntegerImplements()
108 {
109 return new ClassIntegerSupplier();
110 }
111
112 public static IntegerSupplier getIntegerExtends()
113 {
114 return new ClassIntegerSupplier2();
115 }
116
117 public static IntegerSupplier getIntegerAnon()
118 {
119 return new IntegerSupplier()
120 {
121 public int get()
122 {
123 return 3;
124 }
125 };
126 }
127
128 public static IntegerSupplier getIntegerAnonExtends()
129 {
130 return new ClassIntegerSupplier()
131 {
132 public int get()
133 {
134 return 4;
135 }
136 };
137 }
138 //</editor-fold>
139 //<editor-fold desc="short" defaultstate="collapsed">
140
141 public interface ShortSupplier
142 {
143
144 short get();
145 }
146
147 public static class ClassShortSupplier implements ShortSupplier
148 {
149
150 public short get()
151 {
152 return 1;
153 }
154 }
155
156 public static class ClassShortSupplier2 extends ClassShortSupplier
157 {
158
159 public short get()
160 {
161 return 2;
162 }
163 }
164
165 public static ShortSupplier getShortImplements()
166 {
167 return new ClassShortSupplier();
168 }
169
170 public static ShortSupplier getShortExtends()
171 {
172 return new ClassShortSupplier2();
173 }
174
175 public static ShortSupplier getShortAnon()
176 {
177 return new ShortSupplier()
178 {
179 public short get()
180 {
181 return 3;
182 }
183 };
184 }
185
186 public static ShortSupplier getShortAnonExtends()
187 {
188 return new ClassShortSupplier()
189 {
190 public short get()
191 {
192 return 4;
193 }
194 };
195 }
196 //</editor-fold>
197 //<editor-fold desc="long" defaultstate="collapsed">
198
199 public interface LongSupplier
200 {
201
202 long get();
203 }
204
205 public static class ClassLongSupplier implements LongSupplier
206 {
207
208 public long get()
209 {
210 return 1;
211 }
212 }
213
214 public static class ClassLongSupplier2 extends ClassLongSupplier
215 {
216
217 public long get()
218 {
219 return 2;
220 }
221 }
222
223 public static LongSupplier getLongImplements()
224 {
225 return new ClassLongSupplier();
226 }
227
228 public static LongSupplier getLongExtends()
229 {
230 return new ClassLongSupplier2();
231 }
232
233 public static LongSupplier getLongAnon()
234 {
235 return new LongSupplier()
236 {
237 public long get()
238 {
239 return 3;
240 }
241 };
242 }
243
244 public static LongSupplier getLongAnonExtends()
245 {
246 return new ClassLongSupplier()
247 {
248 public long get()
249 {
250 return 4;
251 }
252 };
253 }
254 //</editor-fold>
255 //<editor-fold desc="float" defaultstate="collapsed">
256
257 public interface FloatSupplier
258 {
259
260 float get();
261 }
262
263 public static class ClassFloatSupplier implements FloatSupplier
264 {
265
266 public float get()
267 {
268 return 1;
269 }
270 }
271
272 public static class ClassFloatSupplier2 extends ClassFloatSupplier
273 {
274
275 public float get()
276 {
277 return 2;
278 }
279 }
280
281 public static FloatSupplier getFloatImplements()
282 {
283 return new ClassFloatSupplier();
284 }
285
286 public static FloatSupplier getFloatExtends()
287 {
288 return new ClassFloatSupplier2();
289 }
290
291 public static FloatSupplier getFloatAnon()
292 {
293 return new FloatSupplier()
294 {
295 public float get()
296 {
297 return 3;
298 }
299 };
300 }
301
302 public static FloatSupplier getFloatAnonExtends()
303 {
304 return new ClassFloatSupplier()
305 {
306 public float get()
307 {
308 return 4;
309 }
310 };
311 }
312 //</editor-fold>
313 //<editor-fold desc="double" defaultstate="collapsed">
314
315 public interface DoubleSupplier
316 {
317
318 double get();
319 }
320
321 public static class ClassDoubleSupplier implements DoubleSupplier
322 {
323
324 public double get()
325 {
326 return 1;
327 }
328 }
329
330 public static class ClassDoubleSupplier2 extends ClassDoubleSupplier
331 {
332
333 public double get()
334 {
335 return 2;
336 }
337 }
338
339 public static DoubleSupplier getDoubleImplements()
340 {
341 return new ClassDoubleSupplier();
342 }
343
344 public static DoubleSupplier getDoubleExtends()
345 {
346 return new ClassDoubleSupplier2();
347 }
348
349 public static DoubleSupplier getDoubleAnon()
350 {
351 return new DoubleSupplier()
352 {
353 public double get()
354 {
355 return 3;
356 }
357 };
358 }
359
360 public static DoubleSupplier getDoubleAnonExtends()
361 {
362 return new ClassDoubleSupplier()
363 {
364 public double get()
365 {
366 return 4;
367 }
368 };
369 }
370 //</editor-fold>
371 //<editor-fold desc="byte" defaultstate="collapsed">
372
373 public interface ByteSupplier
374 {
375
376 byte get();
377 }
378
379 public static class ClassByteSupplier implements ByteSupplier
380 {
381
382 public byte get()
383 {
384 return 1;
385 }
386 }
387
388 public static class ClassByteSupplier2 extends ClassByteSupplier
389 {
390
391 public byte get()
392 {
393 return 2;
394 }
395 }
396
397 public static ByteSupplier getByteImplements()
398 {
399 return new ClassByteSupplier();
400 }
401
402 public static ByteSupplier getByteExtends()
403 {
404 return new ClassByteSupplier2();
405 }
406
407 public static ByteSupplier getByteAnon()
408 {
409 return new ByteSupplier()
410 {
411 public byte get()
412 {
413 return 3;
414 }
415 };
416 }
417
418 public static ByteSupplier getByteAnonExtends()
419 {
420 return new ClassByteSupplier()
421 {
422 public byte get()
423 {
424 return 4;
425 }
426 };
427 }
428 //</editor-fold>
429 //<editor-fold desc="char" defaultstate="collapsed">
430
431 public interface CharSupplier
432 {
433
434 char get();
435 }
436
437 public static class ClassCharSupplier implements CharSupplier
438 {
439
440 public char get()
441 {
442 return '1';
443 }
444 }
445
446 public static class ClassCharSupplier2 extends ClassCharSupplier
447 {
448
449 public char get()
450 {
451 return '2';
452 }
453 }
454
455 public static CharSupplier getCharImplements()
456 {
457 return new ClassCharSupplier();
458 }
459
460 public static CharSupplier getCharExtends()
461 {
462 return new ClassCharSupplier2();
463 }
464
465 public static CharSupplier getCharAnon()
466 {
467 return new CharSupplier()
468 {
469 public char get()
470 {
471 return '3';
472 }
473 };
474 }
475
476 public static CharSupplier getCharAnonExtends()
477 {
478 return new ClassCharSupplier()
479 {
480 public char get()
481 {
482 return '4';
483 }
484 };
485 }
486 //</editor-fold>
487 //<editor-fold desc="boolean" defaultstate="collapsed">
488
489 public interface BooleanSupplier
490 {
491
492 boolean get();
493 }
494
495 public static class ClassBooleanSupplier implements BooleanSupplier
496 {
497
498 public boolean get()
499 {
500 return true;
501 }
502 }
503
504 public static class ClassBooleanSupplier2 extends ClassBooleanSupplier
505 {
506
507 public boolean get()
508 {
509 return false;
510 }
511 }
512
513 public static BooleanSupplier getBooleanImplements()
514 {
515 return new ClassBooleanSupplier();
516 }
517
518 public static BooleanSupplier getBooleanExtends()
519 {
520 return new ClassBooleanSupplier2();
521 }
522
523 public static BooleanSupplier getBooleanAnon()
524 {
525 return new BooleanSupplier()
526 {
527 public boolean get()
528 {
529 return false;
530 }
531 };
532 }
533
534 public static BooleanSupplier getBooleanAnonExtends()
535 {
536 return new ClassBooleanSupplier()
537 {
538 public boolean get()
539 {
540 return false;
541 }
542 };
543 }
544 //</editor-fold>
545 //<editor-fold desc="void" defaultstate="collapsed">
546 // Yes, we have to do this one as well. All paths need exercise.
547
548 public interface VoidSupplier
549 {
550
551 void get();
552 }
553
554 public static class ClassVoidSupplier implements VoidSupplier
555 {
556
557 public void get()
558 {
559 return;
560 }
561 }
562
563 public static class ClassVoidSupplier2 extends ClassVoidSupplier
564 {
565
566 public void get()
567 {
568 return;
569 }
570 }
571
572 public static VoidSupplier getVoidImplements()
573 {
574 return new ClassVoidSupplier();
575 }
576
577 public static VoidSupplier getVoidExtends()
578 {
579 return new ClassVoidSupplier2();
580 }
581
582 public static VoidSupplier getVoidAnon()
583 {
584 return new VoidSupplier()
585 {
586 public void get()
587 {
588 return;
589 }
590 };
591 }
592
593 public static VoidSupplier getVoidAnonExtends()
594 {
595 return new ClassVoidSupplier()
596 {
597 public void get()
598 {
599 return;
600 }
601 };
602 }
603 //</editor-fold>
604 }