8 lines
606 B
Plaintext
8 lines
606 B
Plaintext
Class members that are not assigned a default value and are not initialized in a constructor will be set to null by the compiler. Even if code exists to properly set those members, there is a risk that they will be dereferenced before it is called, resulting in a ``++NullPointerException++``.
|
|
|
|
|
|
Because you cannot guarantee that such classes will always be used properly, class members should always be initialized.
|
|
|
|
|
|
This rule flags members which have no default value and which are left uninitialized by at least one class constructor, but which are unconditionally dereferenced somewhere in the code.
|