result. The expressions for which the qualifier holds after the method's execution are
indicated by expression and are specified using a string. The qualifier is specified by
the qualifier annotation element.
Here is an example use:
@EnsuresQualifierIf(result = true, expression = "#1", qualifier = Odd.class)
boolean isOdd(int p1, int p2) {
return p1 % 2 == 1;
}
This annotation is only applicable to methods with a boolean return type.
Some type systems have specialized versions of this annotation, such as org.checkerframework.checker.nullness.qual.EnsuresNonNullIf and org.checkerframework.checker.lock.qual.EnsuresLockHeldIf.
EnsuresQualifier
| Modifier and Type | Class and Description |
|---|---|
| public static @interface | EnsuresQualifierIf.List
A wrapper annotation that makes the |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | Returns: the Java expressions for which the qualifier holds if the method terminates with return valueresult()Returns the Java expressions for which the qualifier holds if the method terminates with return
value |
| public Class | |
| public boolean | Returns: the return value of the method that needs to hold for the postcondition to holdReturns the return value of the method that needs to hold for the postcondition to hold. |
| expression | back to summary |
|---|---|
| public String[] expression() Returns the Java expressions for which the qualifier holds if the method terminates with return
value | |
| qualifier | back to summary |
|---|---|
| public Class Returns the qualifier that is guaranteed to hold if the method terminates with return value
| |
| result | back to summary |
|---|---|
| public boolean result() Returns the return value of the method that needs to hold for the postcondition to hold.
| |
EnsuresQualifierIf annotation repeatable.
Programmers generally do not need to write this. It is created by Java when a programmer
writes more than one EnsuresQualifierIf annotation at the same location.
| Modifier and Type | Method and Description |
|---|---|
| public EnsuresQualifierIf[] |
| value | back to summary |
|---|---|
| public EnsuresQualifierIf[] value() Return the repeatable annotations.
| |