File: ArrayIntro.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 (19 lines) | stat: -rw-r--r-- 608 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
import org.checkerframework.common.value.qual.MinLen;

@SuppressWarnings("lowerbound")
class ArrayIntro {
    void test() {
        int @MinLen(5) [] arr = new int[5];
        int a = 9;
        a += 5;
        a -= 2;
        int @MinLen(12) [] arr1 = new int[a];
        int @MinLen(3) [] arr2 = {1, 2, 3};
        // :: error: (assignment.type.incompatible)
        int @MinLen(4) [] arr3 = {4, 5, 6};
        // :: error: (assignment.type.incompatible)
        int @MinLen(7) [] arr4 = new int[4];
        // :: error: (assignment.type.incompatible)
        int @MinLen(16) [] arr5 = new int[a];
    }
}