checker/tests/nullness/generics/GenericReturnField.java
raw| 1 | // Related to issue #594 |
| 2 | // https://github.com/typetools/checker-framework/issues/594 |
| 3 | // but does not reproduce the problem because that issue depends on |
| 4 | // the error message. See ../../nullness-extra/issue594/ |
| 5 | |
| 6 | import org.checkerframework.checker.nullness.qual.Nullable; |
| 7 | |
| 8 | public class GenericReturnField<T> { |
| 9 | private @Nullable T result = null; |
| 10 | |
| 11 | // Should return @Nullable T |
| 12 | private T getResult() { |
| 13 | // :: error: (return.type.incompatible) |
| 14 | return result; |
| 15 | } |
| 16 | } |