Debian Codegraph @

checker/tests/nullness/java8inference/Issue980.java

raw
1 // Test case that was submitted in Issue 402, but was combined with Issue 979
2 // https://github.com/typetools/checker-framework/issues/979
3
4 import java.util.List;
5 import java.util.stream.Collectors;
6 import java.util.stream.Stream;
7 import org.checkerframework.checker.nullness.qual.Nullable;
8
9 public class Issue980 {
10
11 void m(List<String> strings) {
12 Stream<String> s = strings.stream();
13
14 // This works:
15 List<String> collectedStrings1 = s.collect(Collectors.<String>toList());
16 // This works:
17 List<@Nullable String> collectedStrings2 = s.collect(Collectors.toList());
18
19 List<String> collectedStrings = s.collect(Collectors.toList());
20
21 collectedStrings.forEach(System.out::println);
22 }
23 }