...
Fields declared static final
are also safe for multithreaded use. (See guideline TSM03-J. Do not publish partially initialized objects.) On a cautionary note, however, simply changing the modifier to final
may not prevent attackers from indirectly retrieving an incorrect value from the static
final
variable before its initialization. (See guideline MSC07-J. Eliminate class initialization cycles.) Individual members of the referenced object can also be changed if it is mutable. (See guideline OBJ01-J. Be aware that a final reference may not always refer to immutable _mutable_ data.)
It is also permissible to use a wrapper method to retrieve the value of m_functions
. This has encapsulation advantages as it restricts its accessibility to private
. (See guideline OBJ00-J. Declare data members as private and provide accessible wrapper methods.) However, it is unnecessary when m_functions
needs to be treated like a world-accessible constant.
...