@GuardedBy
注解。
示例:
private Object state;
@GuardedBy("lock") //未知的保护引用
public void bar() {
state = new Object();
}
支持的 @GuardedBy
注解是:
net.jcip.annotations.GuardedBy
javax.annotation.concurrent.GuardedBy
org.apache.http.annotation.GuardedBy
com.android.annotations.concurrency.GuardedBy
androidx.annotation.GuardedBy
com.google.errorprone.annotations.concurrent.GuardedBy