Files
openide/java/java-impl/resources/inspectionDescriptions/VolatileArrayField.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

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>