@Documented @Retention(value=RUNTIME) @Target(value={METHOD,CONSTRUCTOR}) @InheritedAnnotation public @interface EnsuresKeyForIf
As an example, consider the following method in java.util.Map
:
@EnsuresKeyForIf(result=true, expression="key", map="this") public boolean containsKey(String key) { ... }If an invocation
m.containsKey(k)
returns true, then the type of k
can be
inferred to be @KeyFor("m")
.KeyFor
,
EnsuresKeyFor
Modifier and Type | Required Element and Description |
---|---|
java.lang.String[] |
expression
Java expressions that are keys in the given maps after the method returns the given result.
|
java.lang.String[] |
map
Java expressions that are maps, each of which contains each of the expressions' value after
the method returns the given result.
|
boolean |
result
The value the method must return, in order for the postcondition to hold.
|
public abstract boolean result
public abstract java.lang.String[] expression
public abstract java.lang.String[] map