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

public @Interface EnsuresNonNull

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD, CONSTRUCTOR
@PostconditionAnnotation
qualifier:NonNull
@InheritedAnnotation
@Repeatable:List
Imports
java.lang.annotation.Documented, .ElementType, .Repeatable, .Retention, .RetentionPolicy, .Target, org.checkerframework.framework.qual.InheritedAnnotation, .PostconditionAnnotation

Indicates that the value expressions are non-null just after a method call, if the method terminates successfully.

This postcondition annotation is useful for methods that initialize a field:


 @EnsuresNonNull("theMap")
 void initialize() {
   theMap = new HashMap<>();
 }
It can also be used for a method that fails if a given expression is null, indicating that the argument is null if the method returns normally:

 /** Throws an exception if the argument is null. */
 @EnsuresNonNull("#1")
 void assertNonNull(Object arg) { ... }
See Also
EnsuresNonNullIf, NonNull, org.checkerframework.checker.nullness.NullnessChecker

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static @interface
EnsuresNonNull.List

A wrapper annotation that makes the EnsuresNonNull annotation repeatable.

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

Java expressions that are NonNull after successful method termination
value
()

Returns Java expressions that are NonNull after successful method termination.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String[] value()

Returns Java expressions that are NonNull after successful method termination.

Returns:String[]

Java expressions that are NonNull after successful method termination

org.checkerframework.checker.nullness.qual back to summary

public @Interface EnsuresNonNull.List

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD, CONSTRUCTOR
@PostconditionAnnotation
qualifier:NonNull
@InheritedAnnotation

A wrapper annotation that makes the EnsuresNonNull annotation repeatable.

Programmers generally do not need to write this. It is created by Java when a programmer writes more than one EnsuresNonNull annotation at the same location.

Method Summary

Modifier and TypeMethod and Description
public EnsuresNonNull[]

Returns:

the repeatable annotations
value
()

Returns the repeatable annotations.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public EnsuresNonNull[] value()

Returns the repeatable annotations.

Returns:EnsuresNonNull[]

the repeatable annotations