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
|
// Test case for Issue 1838:
// https://github.com/typetools/checker-framework/issues/1838
import java.util.ArrayList;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
class Issue1838 {
public static void main(String[] args) {
f();
}
public static void f() {
List<@Nullable Object> list = new ArrayList<>();
list.add(null);
List<List<@Nullable Object>> listList = new ArrayList<List<@Nullable Object>>();
listList.add(list);
// :: error: (argument.type.incompatible)
processElements(listList);
}
private static void processElements(List<? extends List<Object>> listList) {
for (List<Object> list : listList) {
for (Object element : list) {
element.toString();
}
}
}
}
|