This postcondition annotation is useful for methods that initialize a field:
@EnsuresNonNull("theMap")
void initialize() {
theMap = new HashMap<>();
}
It can also be used for a method that fails if a given expression is null, indicating that the
argument is null if the method returns normally:
/** Throws an exception if the argument is null. */
@EnsuresNonNull("#1")
void assertNonNull(Object arg) { ... }
EnsuresNonNullIf, NonNull, org.checkerframework.checker.nullness.NullnessChecker
| Modifier and Type | Class and Description |
|---|---|
| public static @interface | EnsuresNonNull.List
A wrapper annotation that makes the |
| Modifier and Type | Method and Description |
|---|---|
| public String[] |
| value | back to summary |
|---|---|
| public String[] value() Returns Java expressions that are | |
EnsuresNonNull annotation repeatable.
Programmers generally do not need to write this. It is created by Java when a programmer
writes more than one EnsuresNonNull annotation at the same location.
| Modifier and Type | Method and Description |
|---|---|
| public EnsuresNonNull[] |
| value | back to summary |
|---|---|
| public EnsuresNonNull[] value() Returns the repeatable annotations.
| |