Package com.uber.nullaway.annotations
Annotation Type RequiresNonNull
-
@Retention(CLASS) @Target({METHOD,CONSTRUCTOR}) public @interface RequiresNonNullAn annotation describing a nullability pre-condition for an instance method. Each parameter to the annotation should be a field of the enclosing class. Each call site of the method must ensure that the fields listed in the annotation are non-null before the call. NullAway verifies that this property holds, and uses the property when checking the body of the method. Here is an example:class Foo { @Nullable Object theField; @RequiresNonNull("theField") // @RequiresNonNull("this.theField") is also valid void foo() { // No error, NullAway knows theField is non-null after foo() theField.toString(); } void bar() { // Error, theField may be null before the call to foo() foo(); this.theField = new Object(); // No error foo(); } }
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.String[]value
-