File: Issue577.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,840 kB
  • sloc: java: 145,910; xml: 839; sh: 518; makefile: 401; perl: 26
file content (75 lines) | stat: -rw-r--r-- 1,769 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Test case for issue #577:
// Test with expected errors: checker/tests/nullness/Issue577.java
// https://github.com/typetools/checker-framework/issues/577
class Banana<T extends Number> extends Apple<int[]> {
    @Override
    void fooIssue577Outer(int[] array) {}

    class InnerBanana extends InnerApple<long[]> {
        @Override
        <F2> void foo(int[] array, long[] array2, F2 param3) {}
    }
}

class Apple<T> {
    void fooIssue577Outer(T param) {}

    class InnerApple<E> {
        <F> void foo(T param, E param2, F param3) {}
    }
}

class Pineapple<E> extends Apple<E> {
    @Override
    void fooIssue577Outer(E array) {}
}

class IntersectionAsMemberOf {
    interface MyGenericInterface<F> {
        F getF();
    }

    <T extends Object & MyGenericInterface<String>> void foo(T param) {
        String s = param.getF();
    }
}

class UnionAsMemberOf {
    interface MyInterface<T> {
        T getT();
    }

    class MyExceptionA extends Throwable implements Cloneable, MyInterface<String> {
        public String getT() {
            return "t";
        }
    }

    class MyExceptionB extends Throwable implements Cloneable, MyInterface<String> {
        public String getT() {
            return "t";
        }
    }

    void bar() throws MyExceptionA, MyExceptionB {}

    void foo1(MyInterface<Throwable> param) throws Throwable {
        try {
            bar();
        } catch (MyExceptionA | MyExceptionB ex1) {
            String s = ex1.getT();
        }
    }
}

final class Issue577Outer<K extends Object> {
    private Inner createInner(ReferenceQueue<? super K> q) {
        return new Inner(q);
    }

    private final class Inner {
        private Inner(ReferenceQueue<? super K> q) {}
    }
}

class ReferenceQueue<T> {}