Inspectopedia Help

Instance field used before initialization

Reports instance variables that are read before initialization.

The inspection ignores equality checks with null.

Example:

class Foo { int bar; Foo() { System.out.println(bar); } }

Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables reported as initialized will always be initialized.

Use the Ignore if annotated by option to specify special annotations. The inspection will ignore fields annotated with one of these annotations.

Use the Ignore primitive fields option to ignore uninitialized primitive fields.

Inspection options

Option

Type

Default

Ignore if annotated by

StringList

[]

Ignore primitive fields

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023