Identifies those fields that are immutable from the perspective of a client of a class/object -
that is, whenever a field is (directly or indirectly (for example via a method call))
accessed after initialization it will see the same value.
From this description it follows that direct field read
accesses are possible as long as the value is already finally initialized. In general it is
even possible that the initializing field write is not done by the class itself but done by
a specific caller that is guaranteed to be always executed before the field is (read)
accessed elsewhere.
Here, the initialization phase for a specific field always starts with the call of a
constructor and ends when the field is set to some value (in a thread-safe manner)
or the field is potentially read.
Property manifestations
1. declared final
actually directly declared as final
1. lazy initialized
all field writes and reads have to be known
OPA: all private fields
CPA: all private and package private fields and all protected and public fields that are not accessible by a client
APP: all fields
all writes have to be guarded by a test if the field still has the default value
all reads happen after initialization of the field and are either also guarded by test or happen directly after a field write
the field is set at most once to a value that is not the default value (0, 0l, 0f, 0d, null)
1. effectively final
all criteria of the lazy initialized field have to hold (see previous section)
all reads and writes have to be guarded by the same (synchronization) lock.
1. non-final
a field is non final if non of the the previous cases holds
e.g. not all reads and writes of the field are known
Identifies those fields that are immutable from the perspective of a client of a class/object - that is, whenever a field is (directly or indirectly (for example via a method call)) accessed after initialization it will see the same value. From this description it follows that direct field read accesses are possible as long as the value is already finally initialized. In general it is even possible that the initializing field write is not done by the class itself but done by a specific caller that is guaranteed to be always executed before the field is (read) accessed elsewhere. Here, the initialization phase for a specific field always starts with the call of a constructor and ends when the field is set to some value (in a thread-safe manner) or the field is potentially read.
Property manifestations
1. declared final
1. lazy initialized
0,0l,0f,0d,null)1. effectively final
1. non-final