File: Issue2029.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 (30 lines) | stat: -rw-r--r-- 966 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
import org.checkerframework.checker.index.qual.LTLengthOf;
import org.checkerframework.checker.index.qual.LessThan;
import org.checkerframework.checker.index.qual.NonNegative;

public class Issue2029 {
    void lessThanUpperBound(
            @NonNegative @LessThan("#2") int index, @NonNegative int size, char val) {
        char[] arr = new char[size];
        arr[index] = val;
    }

    void LessThanOffsetLowerBound(
            int[] array,
            @NonNegative @LTLengthOf("#1") int n,
            @NonNegative @LessThan("#2 + 1") int k) {
        array[n - k] = 10;
    }

    void LessThanOffsetUpperBound(
            @NonNegative int n,
            @NonNegative @LessThan("#1 + 1") int k,
            @NonNegative int size,
            @NonNegative @LessThan("#3 + 1") int index) {
        @NonNegative int m = n - k;
        int[] arr = new int[size];
        for (; index < arr.length - 1; index++) {
            arr[index] = 10;
        }
    }
}