mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
28 lines
1020 B
HTML
28 lines
1020 B
HTML
<html>
|
|
<body>
|
|
Reports <code>@GuardedBy</code> annotations in which the guarding field
|
|
is not <code>final</code>.
|
|
<p>Guarding on a non-final field may result in unexpected race conditions, as locks will
|
|
be held on the value of the field (which may change), rather than the field itself.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
private ReadWriteLock lock = new ReentrantReadWriteLock(); //not final 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> |