@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface AssertNonNullIfNonNull
WARNING: Type-checking for this annotation is not implemented at present.
Here is an example use:
@AssertNonNullIfNonNull("id")
@Pure
public @Nullable Long getId() {
return id;
}
Note the direction of the implication. This annotation says that if the result is non-null, then
the variable id
is also non-null. The annotation does not say that if id
is
non-null, then the result is non-null. (There is not currently a way to say the latter, though it
would also be useful.)
You should not write a formal parameter name or this
as the argument of this
annotation. In those cases, use the PolyNull
annotation instead.
NonNull
,
PolyNull
,
NullnessChecker
Modifier and Type | Required Element and Description |
---|---|
java.lang.String[] |
value
Java expression(s) that are non-null after the method returns a non-null vlue.
|
public abstract java.lang.String[] value