| 1 |
// Test case for Issue579 |
| 2 |
// https://github.com/typetools/checker-framework/issues/579 |
| 3 |
|
| 4 |
import java.util.Comparator; |
| 5 |
|
| 6 |
class Issue570<T> implements Comparator<T> { |
| 7 |
private final Comparator<T> real; |
| 8 |
|
| 9 |
@SuppressWarnings("unchecked") |
| 10 |
Issue570(Comparator<? super T> real) { |
| 11 |
this.real = (Comparator<T>) real; |
| 12 |
} |
| 13 |
|
| 14 |
@Override |
| 15 |
public int compare(T a, T b) { |
| 16 |
throw new RuntimeException(); |
| 17 |
} |
| 18 |
|
| 19 |
@Override |
| 20 |
public Comparator<T> thenComparing(Comparator<? super T> other) { |
| 21 |
// :: warning: (known.nonnull) |
| 22 |
return new Issue570<>(real == null ? other : real.thenComparing(other)); |
| 23 |
} |
| 24 |
} |