checker/tests/nullness/java8inference/OneOf.java
raw| 1 | // Test case for Issue 979: |
| 2 | // https://github.com/typetools/checker-framework/issues/979 |
| 3 | |
| 4 | import java.util.List; |
| 5 | |
| 6 | @SuppressWarnings("nullness") // don't bother with implementations |
| 7 | class OneOf { |
| 8 | static List<String> alist; |
| 9 | |
| 10 | static <V> V oneof(V v1, V v2) { |
| 11 | return v1; |
| 12 | } |
| 13 | |
| 14 | static <T> List<T> empty() { |
| 15 | return null; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | class OneOfUse { |
| 20 | List<String> foo() { |
| 21 | return OneOf.oneof(OneOf.alist, OneOf.empty()); |
| 22 | } |
| 23 | } |