| 1 |
// Test case for Issue 1084 |
| 2 |
// https://github.com/typetools/checker-framework/issues/1084 |
| 3 |
|
| 4 |
import org.checkerframework.checker.nullness.qual.NonNull; |
| 5 |
|
| 6 |
class MyOpt<T extends Object> { |
| 7 |
static <S> MyOpt<@NonNull S> empty() { |
| 8 |
throw new RuntimeException(); |
| 9 |
} |
| 10 |
|
| 11 |
static <S> MyOpt<S> of(S p) { |
| 12 |
throw new RuntimeException(); |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
class Issue1084 { |
| 17 |
MyOpt<Long> get() { |
| 18 |
return this.hashCode() > 0 ? MyOpt.of(5L) : MyOpt.empty(); |
| 19 |
} |
| 20 |
|
| 21 |
MyOpt<byte[]> oba = MyOpt.empty(); |
| 22 |
} |