mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
23 lines
656 B
HTML
23 lines
656 B
HTML
<html>
|
|
<body>
|
|
Reports array fields that are declared <code>volatile</code>. Such declarations
|
|
may be confusing because accessing the array itself follows the rules for <code>volatile</code>
|
|
fields, but accessing the array's contents does not.
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Data {
|
|
private volatile int[] idx = new int[0];
|
|
}
|
|
</code></pre>
|
|
<p>
|
|
If such volatile access is needed for array contents, consider using
|
|
<code>java.util.concurrent.atomic</code> classes instead:
|
|
</p>
|
|
<pre><code>
|
|
class Data {
|
|
private final AtomicIntegerArray idx = new AtomicIntegerArray(new int[0]);
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |