Re: JavaMemoryModel: String literals and String.intern()

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Apr 19 2004 - 13:08:21 EDT


This discussion has gotten a little off track. I think things here are
really pretty simple.

Interning the same String value twice is guaranteed to return the same
String
object only if the duration of references to those intern'd String
values overlap.

There is absolutely no desirable idiom that involves synchronizing
on String literals that could not be easily replaced by synchronizing
on some global constant.

So we don't need to worry about this in the memory model.

Bill

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



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