File: ErrorOrders.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 (63 lines) | stat: -rw-r--r-- 1,727 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
package index;

import org.checkerframework.checker.index.qual.GTENegativeOne;
import org.checkerframework.checker.index.qual.IndexFor;
import org.checkerframework.checker.index.qual.SameLenBottom;
import org.checkerframework.checker.index.qual.UpperBoundBottom;
import org.checkerframework.common.value.qual.BottomVal;

/** This class tests that errors are issued in order of postion. */
public class ErrorOrders {

    void test2(int i, int[] a) {
        a[i] = 2;
    }

    int test4(
            @GTENegativeOne @UpperBoundBottom int p1,
            @UpperBoundBottom @GTENegativeOne int p2,
            int @BottomVal [] p3,
            int @SameLenBottom [] p4,
            @BottomVal int p5) {

        @IndexFor("p2") int z = 0;
        @IndexFor("This isn't an expression") int x = z;
        return x;
    }

    void useTest4(int p1, int p2, int[] p3, int[] p4, int p5) {
        test4(p1, test4(p1, p2, p3, p4, p5), p3, p4, p5);
    }

    class InnerClass {
        @IndexFor("This isn't an expression") int x = 0;

        void test2(int i, int[] a) {
            a[i] = 2;
        }
    }
}

class InSameCompilationUnit {
    @IndexFor("This isn't an expression") int x = 0;

    void test2(int i, int[] a) {
        a[i] = 2;
    }

    int test4(
            @GTENegativeOne @UpperBoundBottom int p1,
            @UpperBoundBottom @GTENegativeOne int p2,
            int @BottomVal [] p3,
            int @SameLenBottom [] p4,
            @BottomVal int p5) {

        @IndexFor("p2") int z = 0;
        @IndexFor("This isn't an expression") int x = z;
        return x;
    }

    void useTest4(int p1, int p2, int[] p3, int[] p4, int p5) {
        test4(p1, test4(p1, p2, p3, p4, p5), p3, p4, p5);
    }
}