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
|
// Test case for Issue 399:
// https://github.com/typetools/checker-framework/issues/399
// @skip-test until the issue is fixed
import java.util.ArrayList;
import java.util.Queue;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class IsEmptyPoll extends ArrayList<String> {
void mNonNull(Queue<String> q) {
while (!q.isEmpty()) {
@NonNull String firstNode = q.poll();
}
}
void mNullable(Queue<@Nullable String> q) {
while (!q.isEmpty()) {
// :: error: (assignment.type.incompatible)
@NonNull String firstNode = q.poll();
}
}
void mNoCheck(Queue<@Nullable String> q) {
// :: error: (assignment.type.incompatible)
@NonNull String firstNode = q.poll();
}
}
|