mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
27 lines
828 B
HTML
27 lines
828 B
HTML
<html>
|
|
<body>
|
|
Suggests replacing initialization of fields using assignment with initialization in the field declaration.
|
|
<p>Only reports if the field assignment is located in an instance or static initializer, and
|
|
joining it with the field declaration is likely to be safe.
|
|
In other cases, like assignment inside a constructor, the quick-fix is provided without highlighting,
|
|
as the fix may change the semantics.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
class MyClass {
|
|
static final int intConstant;
|
|
|
|
static {
|
|
intConstant = 10;
|
|
}
|
|
}
|
|
</code></pre>
|
|
The quick fix moves the assigned value to the field initializer removing the class initializer if possible:
|
|
<pre><code>
|
|
class MyClass {
|
|
static final int intConstant = 10;
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<small>Since 2017.2</small>
|
|
</body>
|
|
</html> |