@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface AssertNonNullIfNonNull
Here is an example use:
@AssertNonNullIfNonNull("id")
public @Pure @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.
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