Annotation Interface EnsuresInitialized
@Documented
@Retention(RUNTIME)
@Target({METHOD,CONSTRUCTOR})
@PostconditionAnnotation(qualifier=Initialized.class)
@InheritedAnnotation
@Repeatable(List.class)
public @interface EnsuresInitialized
A method postcondition annotation that guarantees that the given Java expressions are
Initialized after the method terminates successfully.
This annotation is useful when a method initializes a field of an object that is currently
UnderInitialization (or UnknownInitialization). It tells the Initialization
Checker that the field has been assigned a value.
If the receiver is already fully Initialized, this annotation provides no new
information and is trivially true. If you also want to guarantee that a reference field is not
null (for the Nullness Checker), use EnsuresNonNull instead, which implies initialization
but also provides a nullness guarantee.
Note: This is an Initialization Checker postcondition, distinct from EnsuresInitializedFields which is used by the
standalone Initialized Fields Checker.
- See the Checker Framework Manual:
- Initialization Checker
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceA wrapper annotation that makes theEnsuresInitializedannotation repeatable. -
Required Element Summary
Required Elements
-
Element Details
-
value
String[] valueThe Java expressions that are initialized upon successful method termination.- Returns:
- the Java expressions that are initialized
- See the Checker Framework Manual:
- Syntax of Java expressions
-