@Documented @Retention(value=RUNTIME) @Target(value=METHOD) @InheritedAnnotation @Repeatable(value=EnsuresQualifierIf.List.class) public @interface EnsuresQualifierIf
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(final 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 | Required Element and Description |
---|---|
String[] |
expression |
Class<? extends Annotation> |
qualifier |
boolean |
result |
public abstract String[] expression
result()
.public abstract Class<? extends Annotation> qualifier
result()
.