@Documented @Retention(value=RUNTIME) @Target(value={METHOD,CONSTRUCTOR}) @PostconditionAnnotation(qualifier=NonNull.class) @InheritedAnnotation @Repeatable(value=EnsuresNonNull.List.class) public @interface EnsuresNonNull
This postcondition annotation is useful for methods that initialize a field:
@EnsuresNonNull("theMap")
public static void initialize() {
theMap = new HashMap<>();
}
It can also be used for a method that fails if a given expression is null:
/** Throws an exception if the argument is null. */
@EnsuresNonNull("#1")
void assertNonNull(Object arg) { ... }
NonNull
,
NullnessChecker
public abstract String[] value
NonNull
after successful method termination