Annotation Interface ReleasesNoLocks
@Documented
@Retention(RUNTIME)
@Target({METHOD,CONSTRUCTOR})
@InheritedAnnotation
public @interface ReleasesNoLocks
The method maintains a strictly nondecreasing lock held count on the current thread for any locks
that were held prior to the method call. The same property must in general be true of all the
methods it calls, which should themselves be annotated as
@ReleasesNoLocks
or a stronger
annotation such as @
SideEffectFree
.
The method might acquire locks but then release them, or might acquire locks but not release
them (in which case it should also be annotated with @EnsuresLockHeld
or
@EnsuresLockHeldIf
).
This is the default for methods being type-checked that have no @
LockingFree
,
@
MayReleaseLocks
, @
SideEffectFree
, or @
Pure
annotation.
@ReleasesNoLocks
provides a guarantee unlike @
MayReleaseLocks
, which
provides no guarantees. However, @ReleasesNoLocks
provides a weaker guarantee than
@
LockingFree
.
- See Also:
- See the Checker Framework Manual:
- Lock Checker, Example use of @ReleasesNoLocks