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

17 lines
598 B
HTML

<html>
<body>
Reports synchronization on a call to <code>getClass()</code>.
<p>
If the class containing the synchronization is subclassed, the subclass
will
synchronize on a different class object. Usually the call to <code>getClass()</code> can be replaced with a class literal expression, for
example <code>String.class</code>. An even better solution is synchronizing on a <code>private static final</code> lock object, access to
which can be completely controlled.
</p>
<p><b>Example:</b></p>
<pre><code> synchronized(getClass()) {}
</code></pre>
<!-- tooltip end -->
</body>
</html>