final
.
This class has been annotated with the annotation Immutable, from the JCIP annotations package. A non-final field violates the immutability of the class by allowing the value to be changed.
Example 1: The following code for an immutable class mistakenly declares a field public
and not final
.
@Immutable
public class ImmutableInteger {
public int value;
}
[1] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 471
[2] B. Goetz Java Concurrency in Practice. Chapter 3: Sharing Objects Guidelines
[3] Package net.jcip.annotations Specification