mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
20 lines
518 B
HTML
20 lines
518 B
HTML
<html>
|
|
<body>
|
|
Reports assignment to, or modification of <code>static</code> fields from within an instance method.
|
|
<p>Although legal, such assignments are tricky to do
|
|
safely and are often a result of marking fields <code>static</code> inadvertently.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Counter {
|
|
private static int count = 0;
|
|
|
|
void increment() {
|
|
// Warning: updating a static field
|
|
// from an instance method
|
|
count++;
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |