File: IndexForTestLBC.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (29 lines) | stat: -rw-r--r-- 628 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
package index;

import org.checkerframework.checker.index.qual.IndexFor;

@SuppressWarnings("upperbound")
public class IndexForTestLBC {
    int[] array = {0};

    void test1(@IndexFor("array") int i) {
        int x = this.array[i];
    }

    void callTest1(int x) {
        test1(0);
        test1(1);
        test1(2);
        test1(array.length);
        // :: error: (argument.type.incompatible)
        test1(array.length - 1);
        if (array.length > x) {
            // :: error: (argument.type.incompatible)
            test1(x);
        }

        if (array.length == x) {
            test1(x);
        }
    }
}