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 | Class and Description |
|---|---|
| public static @interface | EnsuresKeyForIf.List
A wrapper annotation that makes the |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | expression()
Java expressions that are keys in the given maps after the method returns the given result. |
| public String[] | Returns: Java expressions whose values are maps, each of which contains each expression value as a key (after the method returns the given result)Returns Java expressions whose values are maps, each of which contains each expression value as a key (after the method returns the given result). |
| public boolean |
| expression | back to summary |
|---|---|
| public String[] expression() Java expressions that are keys in the given maps after the method returns the given result. | |
| map | back to summary |
|---|---|
| public String[] map() Returns Java expressions whose values are maps, each of which contains each expression value as a key (after the method returns the given result).
| |
| result | back to summary |
|---|---|
| public boolean result() The value the method must return, in order for the postcondition to hold. | |
EnsuresKeyForIf annotation repeatable.
Programmers generally do not need to write this. It is created by Java when a programmer
writes more than one EnsuresKeyForIf annotation at the same location.
| Modifier and Type | Method and Description |
|---|---|
| public EnsuresKeyForIf[] |
| value | back to summary |
|---|---|
| public EnsuresKeyForIf[] value() Returns the repeatable annotations.
| |