Debian Codegraph @

checker/tests/nullness/generics/Issue335.java

raw
1 // Test case for Issue 335:
2 // https://github.com/typetools/checker-framework/issues/335
3
4 import org.checkerframework.checker.nullness.qual.Nullable;
5
6 class Pair<A, B> {
7 static <C, D> Pair<C, D> of(@Nullable C first, @Nullable D second) {
8 throw new RuntimeException();
9 }
10 }
11
12 class Optional<S> {
13 static <T> Optional<T> of(T reference) {
14 throw new RuntimeException();
15 }
16 }
17
18 class Issue335 {
19 Optional<Pair<String, String>> m(String one, String two) {
20 return Optional.of(Pair.of(one, two));
21 }
22 }