File: Unions.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (49 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public class Unions {
    void foo1(MyInterface<Throwable> param) throws Throwable {
        try {
            bar();
        } catch (MyExceptionA | MyExceptionB ex) {
            typeVar(ex);
            typeVarIntersection(ex);

            typeVarWildcard(ex, param);
            typeVarWildcard2(ex, param);
        }
    }

    void foo2(MyInterface<Throwable> param) throws Throwable {
        try {
            bar();
        } catch (SubMyExceptionA | SubMyExceptionA2 ex) {
            typeVar(ex);
            typeVar2(ex, ex);

            typeVarIntersection(ex);

            typeVarWildcard(ex, param);
            typeVarWildcard2(ex, param);
        }
    }

    <T extends Cloneable & MyInterface<String>> void typeVarIntersection(T param) {}

    <T extends Throwable> void typeVar(T param) {}

    <T extends Throwable> void typeVar2(T param, T param2) {}

    <T extends Throwable> void typeVarWildcard(T param, MyInterface<? extends T> myInterface) {}

    <T extends Throwable> void typeVarWildcard2(T param, MyInterface<? super T> myInterface) {}

    void bar() throws MyExceptionA, MyExceptionB {}

    interface MyInterface<T> {}

    class MyExceptionA extends Throwable implements Cloneable, MyInterface<String> {}

    class MyExceptionB extends Throwable implements Cloneable, MyInterface<String> {}

    class SubMyExceptionA extends MyExceptionA {}

    class SubMyExceptionA2 extends MyExceptionA {}
}