Annotation Interface EnsuresKeyFor
@Documented
@Retention(RUNTIME)
@Target({METHOD,CONSTRUCTOR})
@PostconditionAnnotation(qualifier=KeyFor.class)
@InheritedAnnotation
@Repeatable(List.class)
public @interface EnsuresKeyFor
Indicates that the value expressions evaluate to a value that is a key in all the given maps, if
the method terminates successfully.
Consider the following method from java.util.Map
:
@EnsuresKeyFor(value="key", map="this") public @Nullable V put(K key, V value) { ... }
This method guarantees that key
has type @KeyFor("this")
after the method
returns.
- See Also:
- See the Checker Framework Manual:
- Map Key Checker
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
A wrapper annotation that makes theEnsuresKeyFor
annotation repeatable. -
Required Element Summary
-
Element Details
-
value
String[] valueJava expressions that are keys in the given maps on successful method termination.- See the Checker Framework Manual:
- Syntax of Java expressions
-
map
Returns Java expressions whose values are maps, each of which contains each expression value as a key (after successful method termination).- Returns:
- Java expressions whose values are maps, each of which contains each expression value as a key (after successful method termination)
- See the Checker Framework Manual:
- Syntax of Java expressions
-