Debian Codegraph @

checker/tests/nullness/generics/Issue282.java

raw
1 // Test case for Issue 282
2 // https://github.com/typetools/checker-framework/issues/282
3
4 import java.util.Collection;
5 import java.util.Comparator;
6 import java.util.Set;
7 import org.checkerframework.checker.nullness.qual.*;
8
9 @SuppressWarnings("nullness")
10 abstract class ImmutableSortedSet<E extends @NonNull Object> implements Set<E> {
11 static <E> ImmutableSortedSet<E> copyOf(
12 Comparator<? super E> comparator, Collection<? extends E> elements) {
13 return null;
14 }
15 }
16
17 @SuppressWarnings("nullness")
18 abstract class Ordering<T> implements Comparator<T> {
19 static Ordering<Object> usingToString() {
20 return null;
21 }
22 }
23
24 abstract class Example {
25 private static <@NonNull T extends @NonNull Object> ImmutableSortedSet<T> setSortedByToString(
26 Collection<T> set) {
27 return ImmutableSortedSet.copyOf(Ordering.usingToString(), set);
28 }
29 }