Debian Codegraph @

framework/tests/all-systems/Issue1006.java

raw
1 // Test case for Issue 1006:
2 // https://github.com/typetools/checker-framework/issues/1006
3
4 import java.util.Map;
5 import java.util.function.Function;
6 import java.util.stream.Collectors;
7 import java.util.stream.Stream;
8
9 @SuppressWarnings("") // Ignore type-checking errors.
10 class Issue1006 {
11 void foo(Stream<String> m, Map<String, Integer> im) {
12 Map<String, Integer> l = m.collect(Collectors.toMap(Function.identity(), im::get));
13 }
14
15 // alternative version with same crash
16 Map<String, Long> bar(String src) {
17 return Stream.of(src)
18 .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
19 }
20 }