Open msridhar opened 6 years ago
We could add partial support for Checker Framework nullness method annotations; see here.
Note: In addition to supporting fields, this should be extended to getters and setters. There is a case internally where writing @Contract("this.getFoo() == null -> false") bar()
would help avoid redundant checks or casts, since testing for nullability is done by the bar()
validation function.
Alternatively, this could be: @Contract("foo == null -> false") bar()
and @Contract("foo != null -> !null") getFoo()
In #129 we added (some) support for JetBrains
@Contract
annotations. We should somehow extend this support to fields, e.g., to handle the example in this comment. This will require going beyond what is expressible with standard@Contract
annotations though and will likely require introducing our own annotation.