RE: JavaMemoryModel: Unexpected weakness/divergence in old JVM spec of final fields

From: David Holmes (
Date: Mon Dec 29 2003 - 17:25:17 EST

<I've trimmed the cc list>

Bill Pugh wrote:
> So, this suggests that it is acceptable for the VM to reject with a
> either a class file format or verification error any classfile in
> which a final field is initialized more than once.

Considering the binary incompatible change of a non-final field to a
final field, the JLS already states that the IllegalAccessError will
be thrown in such a case. It's almost as if that aspect of
PUTSTATIC/PUTFIELD was put in place just to catch this sort of change.

> However, since the current 1.5 VM doesn't reject them, we probably
> can't require that VMs reject such classfiles, only encourage it.

I would hope that we could add this to the verifier. It's not
surprising the current VMs don't reject such class files as there is
no requirement to do so.

David Holmes

JavaMemoryModel mailing list -

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