Top Description Methods
org.checkerframework.checker.nullness.qual

public @Interface AssertNonNullIfNonNull

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

Indicates that if the method returns a non-null value, then the value expressions are also non-null.

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.

See Also
NonNull, PolyNull, org.checkerframework.checker.nullness.NullnessChecker

Method Summary

Modifier and TypeMethod and Description
public String[]
value()

Java expression(s) that are non-null after the method returns a non-null value.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String[] value()

Java expression(s) that are non-null after the method returns a non-null value.