mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
28 lines
934 B
HTML
28 lines
934 B
HTML
<html>
|
|
<body>
|
|
Reports <code>synchronized</code> statements with empty bodies.
|
|
<p>
|
|
Empty <code>synchronized</code> statements are sometimes used to wait for other threads to
|
|
release a particular resource. However, there is no guarantee that the same resource
|
|
won't be acquired again right after the empty <code>synchronized</code> statement finishes.
|
|
For proper synchronization, the resource should be utilized inside the <code>synchronized</code> block.
|
|
</p>
|
|
<p>
|
|
Also, an empty <code>synchronized</code> block may appear after a refactoring
|
|
when redundant code was removed. In this case, the <code>synchronized</code> block
|
|
itself will be redundant and should be removed as well.
|
|
</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
synchronized(lock) {}
|
|
</code></pre>
|
|
<p>
|
|
A quick-fix is suggested to remove the empty synchronized statement.
|
|
</p>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
This inspection is disabled in JSP files.
|
|
<p>
|
|
|
|
</body>
|
|
</html> |