Redundant field initialization
Reports fields explicitly initialized to their default values.
Example:
class Foo {
int foo = 0;
List bar = null;
}
After the quick-fix is applied:
class Foo {
int foo;
List bar;
}
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
RedundantFieldInitialization- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Use the inspection settings to only report explicit null
initialization, for example:
class Foo {
int foo = 0; // no warning
List bar = null; // redundant field initialization warning
}
Inspection options
Here you can find the description of settings available for the Redundant field initialization inspection, and the reference of their default values.
- Only warn on initialization to null
Not selected
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 242.22892 |
Last modified: 11 September 2024