Non-final field referenced in 'hashCode()'

Last modified: 03 December 2024

Reports implementations of hashCode() that access non-final variables.

Such access may result in hashCode() returning different values at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes.

Example:

A quick-fix is suggested to make the field final: