| 1 |
// Test case for Issue #807: |
| 2 |
// https://github.com/typetools/checker-framework/issues/807 |
| 3 |
|
| 4 |
import java.util.function.Consumer; |
| 5 |
|
| 6 |
class Issue807 { |
| 7 |
|
| 8 |
class MyEntry<K, V> { |
| 9 |
MyEntry(MyEntry<? extends K, ? extends V> e) {} |
| 10 |
} |
| 11 |
|
| 12 |
<K, V> Consumer<MyEntry<K, V>> entryConsumer(Consumer<? super MyEntry<K, V>> action) { |
| 13 |
// The "new MyEntry" isn't a subtype of "? super MyEntry" in |
| 14 |
// most type systems. Suppress that error, as it's not the |
| 15 |
// point of this test. |
| 16 |
@SuppressWarnings("") |
| 17 |
Consumer<MyEntry<K, V>> res = e -> action.accept(new MyEntry<>(e)); |
| 18 |
return res; |
| 19 |
} |
| 20 |
} |