How «final» is final?

Although the concept of «final» fields is quite simple, its implementation in Java can lead to surprising effects. First of all, the Java VM and Java language have a slightly different understanding of "final". Second (and unfortunately) declaring a field as final doesn't mean that the VM or the programmer can really rely on its immutability.

This talk will show the different aspects of "finality" and their impact on the Java compiler and the Java VM. It will demonstrate how finality can be circumvented in Java with the help of reflection or sun.misc.Unsafe. And finally it will discuss the impacts this has on the optimizations done by the JIT compiler and various workarounds like the non-standard @Stable annotation or -XX:TrustFinalNonStaticFields.

Volker Simonis 

Works for SAP in the SAP JVM Technology group. OpenJDK contributor from the very beginning and helped SAP and the SAP JVM team engage in the OpenJDK project. Project lead of the OpenJDK PowerPC/AIX porting project, a JDK8 committer and JDK9 reviewer.