Inspectopedia Help

Redundant field initialization

Reports fields explicitly initialized to their default values.


class Foo { int foo = 0; List bar = null; }
class Foo { int foo; List bar; }

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.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.14841

Last modified: 12 March 2024