File: Interface.java

package info (click to toggle)
checker-framework-java 3.0.1%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,736 kB
  • sloc: java: 145,286; xml: 785; sh: 456; makefile: 401; perl: 26
file content (42 lines) | stat: -rw-r--r-- 894 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
// Test case for Issue 658:
// https://github.com/typetools/checker-framework/issues/658
// @skip-test

import org.checkerframework.common.util.report.qual.*;

class Interface {
    interface A {
        @ReportCall
        boolean equals(Object o);

        @ReportCall
        void mine();
    }

    class B implements A {
        public void mine() {}
    }

    interface C extends A {}

    void foo(A a, B b, C c, Object o) {
        // :: error: (methodcall)
        if (a.equals(o)) {}
        // :: error: (methodcall)
        if (b.equals(o)) {}
        // :: error: (methodcall)
        if (c.equals(o)) {}

        // Don't report this call.
        if (o.equals(a)) {}
    }

    void bar(A a, B b, C c, Object o) {
        // :: error: (methodcall)
        a.mine();
        // :: error: (methodcall)
        b.mine();
        // :: error: (methodcall)
        c.mine();
    }
}