Debian Codegraph @

checker/tests/nullness/java8inference/Issue953bInference.java

raw
1 // Test case that was submitted in Issue 953, but was combined with Issue 979
2 // https://github.com/typetools/checker-framework/issues/979
3
4 import java.util.*;
5 import java.util.function.Function;
6 import org.checkerframework.checker.nullness.qual.NonNull;
7
8 public class Issue953bInference {
9 private static List<List<?>> strs = new ArrayList<>();
10
11 public static <R, T> List<@NonNull R> mapList(
12 List<@NonNull T> list, Function<@NonNull T, @NonNull R> func) {
13 ArrayList<@NonNull R> r = new ArrayList<>(list.size());
14 for (T t : list) r.add(func.apply(t));
15 return r;
16 }
17
18 public static List<String> test() {
19 return mapList(
20 strs,
21 s -> {
22 return new String();
23 });
24 }
25 }