mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
31 lines
857 B
HTML
31 lines
857 B
HTML
<html>
|
|
<body>
|
|
Reports non-final fields that are accessed in both <code>synchronized</code> and
|
|
non-<code>synchronized</code> contexts.
|
|
<code>volatile</code> fields as well as accesses in constructors and initializers are ignored by this inspection.
|
|
<p>
|
|
Such "partially synchronized" access is often the result of a coding oversight
|
|
and may lead to unexpectedly inconsistent data structures.
|
|
</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
public class Program {
|
|
Console console; // warning: Field 'console' is accessed in both synchronized and unsynchronized contexts
|
|
|
|
public synchronized void execute() {
|
|
console.print("running");
|
|
}
|
|
|
|
public void check() {
|
|
console.check();
|
|
}
|
|
}
|
|
</code>
|
|
</pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
Use the option to specify if simple getters and setters are counted as accesses too.
|
|
<p>
|
|
|
|
</body>
|
|
</html> |