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);
}
}
}
|