| 1 |
// Test case for Issue 1046: |
| 2 |
// https://github.com/typetools/checker-framework/issues/1046 |
| 3 |
// Additonal test case: checker/tests/nullness/Issue1046.java |
| 4 |
|
| 5 |
import java.util.List; |
| 6 |
import java.util.function.Function; |
| 7 |
import org.checkerframework.checker.nullness.qual.UnknownKeyFor; |
| 8 |
|
| 9 |
class Issue1046Java8 { |
| 10 |
interface EnumMarker {} |
| 11 |
|
| 12 |
enum MyEnum implements EnumMarker { |
| 13 |
A, |
| 14 |
B; |
| 15 |
} |
| 16 |
|
| 17 |
static class NS2Lists { |
| 18 |
@SuppressWarnings("nullness") |
| 19 |
static <F, T> List<T> transform(List<F> p, Function<? super F, ? extends T> q) { |
| 20 |
return null; |
| 21 |
} |
| 22 |
|
| 23 |
static <F, T> List<F> transform2(List<F> p, Function<? super F, ? extends T> q) { |
| 24 |
return p; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
abstract class NotSubtype2 { |
| 29 |
void test(List<MyEnum> p) { |
| 30 |
NS2Lists.transform2(p, foo()); |
| 31 |
NS2Lists.transform(p, foo()); |
| 32 |
} |
| 33 |
|
| 34 |
abstract Function<? super @UnknownKeyFor EnumMarker, Number> foo(); |
| 35 |
} |
| 36 |
} |