Class CompletionLock

java.lang.Object
org.microbean.lang.CompletionLock

public final class CompletionLock extends Object
A utility class logically containing a single Lock that is used to guard against concurrent symbol completion.

The javax.lang.model.* classes make no guarantees about thread safety. Certain operations on TypeMirror and Element, particularly TypeMirror.getKind() and Element.getKind() operations, will result in symbol completion, which may involve modification of the TypeMirror or Element in question. It is imperative that this modification be performed under global lock if thread safety is to be preserved, and that is the function of this class.

Note that DelegatingTypeMirror and DelegatingElement automatically perform such locking, and all operations in Lang that could result in symbol completion also perform such locking.

Author:
Laird Nelson
See Also: