Annotation Type GuardedBy
-
@Documented @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(GuardedByUnknown.class) @DefaultQualifierInHierarchy @DefaultFor(value={EXCEPTION_PARAMETER,UPPER_BOUND}, typeKinds={BOOLEAN,BYTE,CHAR,DOUBLE,FLOAT,INT,LONG,SHORT}, types={java.lang.String.class,java.lang.Void.class}) @UpperBoundFor(typeKinds={BOOLEAN,BYTE,CHAR,DOUBLE,FLOAT,INT,LONG,SHORT}, types=java.lang.String.class) public @interface GuardedBy
Indicates that a thread may dereference the value referred to by the annotated variable only if the thread holds all the given lock expressions.@GuardedBy({})
is the default type qualifier.The argument is a string or set of strings that indicates the expression(s) that must be held, using the syntax of Java expressions described in the manual. The expressions evaluate to an intrinsic (built-in, synchronization) monitor or an explicit
Lock
. The expression"<self>"
is also permitted; the type@GuardedBy("<self>") Object o
indicates that the value referenced byo
is guarded by the intrinsic (monitor) lock of the value referenced byo
.Two
@GuardedBy
annotations with different argument expressions are unrelated by subtyping.- See Also:
Holding
- See the Checker Framework Manual:
- Lock Checker, Example use of @GuardedBy
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String[]
value
The Java value expressions that need to be held.
-
-
-
Element Detail
-
value
@JavaExpression java.lang.String[] value
The Java value expressions that need to be held.- See Also:
- Syntax of Java expressions
- Default:
- {}
-
-