checkers.nullness.quals
Annotation Type NonNullOnEntry


@Documented
@Retention(value=RUNTIME)
public @interface NonNullOnEntry

Indicates a method precondition: the method expects the specified variables (typically field references) to be non-null when the annotated method is invoked.

For example:

  @Nullable Object field1;
  @Nullable Object field2;

  @NonNullOnEntry("field1")
  void method1() {
    field1.toString();        // OK, field1 is known to be non-null
    field2.toString();        // error, might throw NullPointerException
  }

  void method2() {
    field1 = new Object();
    method1();                // OK, satisfies method precondition
    field1 = null;
    method1();                // error, does not satisfy method precondition
  }
 


Required Element Summary
Modifier and Type Required Element and Description
 String[] value
          Java expression(s) that are non-null when the method is entered -- that is, when it is invoked.
 

Element Detail

value

public abstract String[] value
Java expression(s) that are non-null when the method is entered -- that is, when it is invoked.

See Also:
Syntax of Java expressions