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

26 lines
807 B
HTML

<html>
<body>
Reports access to <code>static</code> fields that are of a non-thread-safe type.
<p>
When a <code>static</code> field is accessed from an instance method or a non-synchronized block,
multiple threads can access that field.
This can lead to unspecified side effects, like exceptions and incorrect results.
</p>
<p><b>Example:</b></p>
<pre><code>
class Sample {
private static final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String method() {
return df.format("");
}
}
</code></pre>
<!-- tooltip end -->
<p>
You can specify which types should be considered not thread-safe.
Only fields with these exact types or initialized with these exact types are reported,
because there may exist thread-safe subclasses of these types.
</p>
</body>
</html>