checker.src.org.checkerframework.checker.nullness.qual.KeyFor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker Show documentation
Show all versions of checker Show documentation
The Checker Framework enhances Java’s type system to
make it more powerful and useful. This lets software developers
detect and prevent errors in their Java programs.
The Checker Framework includes compiler plug-ins ("checkers")
that find bugs or verify their absence. It also permits you to
write your own compiler plug-ins.
package org.checkerframework.checker.nullness.qual;
import java.lang.annotation.*;
import org.checkerframework.framework.qual.*;
/**
* Indicates that the value assigned to the annotated variable is a key for at least the given map(s).
*
*
* The value of the annotation is the reference name of the map.
* Suppose that config
is a Map<String, String>
.
* Then the declaration
*
*
@KeyFor("config") String key = "HOSTNAME";
*
* indicates that "HOSTNAME" is a key in config
.
*
*
* The value of the annotation can also be a set of reference names of the maps.
* If defaultConfig
is also a Map<String, String>
, then
*
*
@KeyFor({"config","defaultConfig"}) String key = "HOSTNAME";
*
* indicates that "HOSTNAME" is a key in config
and in defaultConfig
.
*
* @checker_framework.manual #map-key-checker Map Key Checker
*/
@SubtypeOf(UnknownKeyFor.class)
@Documented
@FieldIsExpression
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
public @interface KeyFor {
/**
* Java expression(s) that evaluate to a map for which the annotated type is a key.
* @checker_framework.manual #java-expressions-as-arguments Syntax of Java expressions
*/
public String[] value();
}