Inspectopedia 2024.3 Help

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.

Settings or Preferences | Editor | Inspections | Java | Code style issues

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:

IntelliJ IDEA 2024.3, Qodana for JVM 2024.3,

Can be installed with plugin:

Java, 243.23126

Last modified: 03 December 2024