@NotNull field is not initialized
Reports fields annotated as not-null that are not initialized in the constructor.
Example:
Such fields may violate the not-null constraint. In the example above, the setValue
parameter is annotated as not-null, but getValue
may return null if the setter was not called.
Configure the inspection:
Use the Ignore fields which could be initialized implicitly option to control whether a warning should be issued if the field could be initialized implicitly (e.g. via a dependency injection).
Use the Ignore fields initialized in setUp() method option to control whether a warning should be issued if the field is written in the test case
setUp()
method.
Inspection options
Option | Type | Default |
---|---|---|
Ignore fields which could be initialized implicitly | Checkbox | true |
Ignore fields initialized in setUp() method | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |