mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
27 lines
1.0 KiB
HTML
27 lines
1.0 KiB
HTML
<html>
|
|
<body>
|
|
Reports <code>@GuardedBy</code> annotations on instance fields or methods
|
|
in which the guard is a <code>static</code> field. Guarding a non-static by a static may result in excessive lock contention,
|
|
as access to each locked field in any object instance will prevent simultaneous access to that field in every object instance.
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
private static ReadWriteLock lock = new ReentrantReadWriteLock(); //static guarding field
|
|
private Object state;
|
|
|
|
@GuardedBy("lock")
|
|
public void bar() {
|
|
state = new Object();
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Supported <code>@GuardedBy</code> annotations are:</p>
|
|
<ul>
|
|
<li><code>net.jcip.annotations.GuardedBy</code></li>
|
|
<li><code>javax.annotation.concurrent.GuardedBy</code></li>
|
|
<li><code>org.apache.http.annotation.GuardedBy</code></li>
|
|
<li><code>com.android.annotations.concurrency.GuardedBy</code></li>
|
|
<li><code>androidx.annotation.GuardedBy</code></li>
|
|
<li><code>com.google.errorprone.annotations.concurrent.GuardedBy</code></li>
|
|
</ul>
|
|
</body>
|
|
</html> |