@Documented
@Target(value={METHOD,CONSTRUCTOR})
@Retention(value=RUNTIME)
public @interface Ensures
When run time checking of contracts is enabled, postconditions
are checked at method exit, when the method exits normally, of the
and throw a PreconditionError when they
are violated. Postconditions are not checked when the method exits
by throwing an exception.
ThrowEnsures| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String[] |
value
The list of postconditions that must be met by the annotated
method, written as strings.
|
public abstract java.lang.String[] value
The keyword result refers to the value returned from
the method, if any. It is an error to have a method parameter
named result.
The old(expression) pseudo-method construct refers to
the value of its argument before execution of the method.
expression must be a balanced expression, with regard to
parentheses. The old() construct is preprocessed using
the following simple rules (similar to macro expansion done by a
C preprocessor):
old, followed by an opening parenthesis, is
recognized as an identifier;
It is an error to call a method named old from within
a postcondition.