JavaMemoryModel: Clarification of final field safe contexts

From: Bill Pugh (
Date: Thu Aug 05 2004 - 13:54:23 EDT

We made one small clarification in the spec.

Remember that to allow for reflective modifications to final fields,
we allow for the definition of final field safe contexts (FFSC). In
if reads of final fields may not be moved into or out of final field
safe contexts. Thus, if in a final field safe context, you initialize
an object and then modify the final fields of the object using
you are guaranteed that code that occurs after the FFSC will see the
updated value for the final field.

Previously, we had been thinking that final field safe contexts would be
handled by some sort of executor like framework. Upon more thought, we
decided that it would be very helpful if a method, such as a clone
could be denoted a final field safe context.

This required a small clarification in the semantics, since values can
be passed to and from a FFSC without going through shared memory. The
new clarification (clause d of the rule for memory chains) gives the

If $r$ is a read
of a final instance field of an object constructed within a final field
safe context
ending with the synthetic action $a$ such that $a \po r$, then
it must be the case that $a \mc r$.

Updated spec at

JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:08 EDT