Java final
field semantics
Contrary to popular belief,
a final
field
in Java is not the same thing as
a final
variable
that may only be assigned to once.
The Java memory model (JMM)
not only has a separate
section explaining the semantics
but also introduces two partial orders—dereference chain (dereferences
)
and memory chain (mc
) just for the sake of specifying final
fields.
This presentation touches almost all aspects of the JMM and has many examples of programs which behavior a reader may find unexpected. I presented it to my colleagues at NetCracker Technology and at ZeptoLab. Vladimir Sitnikov, who is a co-author of the presentation, made a public talk (in Russian)