...
Another pitfall arises when static-final
is used inappropriately to declare mutable data. (See guideline OBJ01-J. Be aware Do not assume that declaring a final reference may refer to _mutable_ datareference to be final causes the referenced object to be immutable.)
Noncompliant Code Example
...
Note that the variable googol
is actually a static final reference to an object of type BigDecimal
. Because instances of BigDecimal
are immutable, guideline OBJ01-J. Be aware Do not assume that declaring a final reference may refer to _mutable_ datareference to be final causes the referenced object to be immutable is irrelevant in this case.
...