RE: JavaMemoryModel: Re: Are this$x fields final?

From: Jerry Schwarz (
Date: Wed May 26 2004 - 22:48:30 EDT

At 03:46 PM 5/26/2004, David Holmes wrote:
>Rather then dictate implementation can we not simply state that for the
>purposes of the JMM, references to the enclosing instance of an inner
>instance behave as-if they were accessed through a final field of the inner

Creating an "as-if" rule is the proper way to proceed. References to this$x
are obviously implementation hacks. But the above isn't the right
rule. What programmers need is a guarantee that references to an class
always work. That is, they never generate a null pointer. Personally I
think this is implicit in the language definition of inner classes and JSR
133 doesn't need to say anything about it. But I wouldn't object to some

If people need more synchronization than that then they should implement it
themselves. Saying that the inner class always has a final field has
implications for its constructors that we don't need. It associates being
an inner class with a property (how it's constructors behave) that doesn't
seem to have any relationship to the property of being an inner class.

>David Holmes
>JavaMemoryModel mailing list -

JavaMemoryModel mailing list -

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