Debian Codegraph @

framework/tests/all-systems/Unions.java

raw
1 public class Unions {
2 void foo1(MyInterface<Throwable> param) throws Throwable {
3 try {
4 bar();
5 } catch (MyExceptionA | MyExceptionB ex) {
6 typeVar(ex);
7 typeVarIntersection(ex);
8
9 typeVarWildcard(ex, param);
10 typeVarWildcard2(ex, param);
11 }
12 }
13
14 void foo2(MyInterface<Throwable> param) throws Throwable {
15 try {
16 bar();
17 } catch (SubMyExceptionA | SubMyExceptionA2 ex) {
18 typeVar(ex);
19 typeVar2(ex, ex);
20
21 typeVarIntersection(ex);
22
23 typeVarWildcard(ex, param);
24 typeVarWildcard2(ex, param);
25 }
26 }
27
28 <T extends Cloneable & MyInterface<String>> void typeVarIntersection(T param) {}
29
30 <T extends Throwable> void typeVar(T param) {}
31
32 <T extends Throwable> void typeVar2(T param, T param2) {}
33
34 <T extends Throwable> void typeVarWildcard(T param, MyInterface<? extends T> myInterface) {}
35
36 <T extends Throwable> void typeVarWildcard2(T param, MyInterface<? super T> myInterface) {}
37
38 void bar() throws MyExceptionA, MyExceptionB {}
39
40 interface MyInterface<T> {}
41
42 class MyExceptionA extends Throwable implements Cloneable, MyInterface<String> {}
43
44 class MyExceptionB extends Throwable implements Cloneable, MyInterface<String> {}
45
46 class SubMyExceptionA extends MyExceptionA {}
47
48 class SubMyExceptionA2 extends MyExceptionA {}
49 }