@Documented @Retention(value=RUNTIME) @Target(value={FIELD,PARAMETER,LOCAL_VARIABLE,TYPE_USE}) public @interface GuardedBy
Lock
.
This annotation does not indicate whether or not the given lock is held at the moment that execution reaches the annotation. It merely indicates that the lock must be held when the variable is accessed.
The argument is a string that indicates which lock guards the annotated variable:
this
: The intrinsic lock of the object in whose class the field is defined.
class-name.this
: For inner classes, it may be necessary to disambiguate 'this';
the class-name.this
designation allows you to specify which 'this' reference is intended
itself
: For reference (non-primitive) fields only; the object to which the field refers.
field-name
: The lock object is referenced by the (instance or static) field
specified by field-name
.
class-name.field-name
: The lock object is reference by the static field specified
by class-name.field-name
.
method-name()
: The lock object is returned by calling the named nil-ary method.
class-name.class
: The Class object for the specified class should be used as the lock object.
@GuardedBy
one, because the unannotated type may be
used in any context where the @GuardedBy
one is.
Holding
,
HoldingOnEntry
public abstract String[] value
LockHeld
.