this の static フィールドまたはメソッドにある @GuardedBy アノテーションを報告します。
static 要素を非 static 要素でガードすると過剰な同時実行が発生する可能性があります。また、異なるオブジェクトコンテキストでロックすることで、複数のスレッドがガードされたフィールドに同時にアクセスできてしまう可能性があります。
例:
private ReadWriteLock lock = new ReentrantReadWriteLock();
@GuardedBy("lock")
public static void bar() {
// ...
}
サポート対象の @GuardedBy アノテーションは以下の通りです。
net.jcip.annotations.GuardedByjavax.annotation.concurrent.GuardedByorg.apache.http.annotation.GuardedBycom.android.annotations.concurrency.GuardedByandroidx.annotation.GuardedBycom.google.errorprone.annotations.concurrent.GuardedBy