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

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>