Re: JavaMemoryModel: Motivation and Semantics for Immutable objects

From: Bill Pugh (pugh@cs.umd.edu)
Date: Thu Aug 09 2001 - 14:23:46 EDT


At 7:32 AM +1000 8/7/01, David Holmes wrote:
>Bill,
>
>I too am a little confused about how to get an immutable object. Based on
>what you say then to get an Immutable String either:
>
>a) All fields of String must be final; or
>b) All references to String objects must be final

I am trying to explain the process by which we got to the semantics
that are proposed.

If all fields of String are final, we get the required semantics.
This will require that the existing implementation of String be
changed so that all of the fields are marked as final, but this
should not be a problem.

However, we also want to give some data race protection to classes
that have some but not all fields marked as final.

The JavaOne BOF slides are probably the best, short explaination.

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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