Hi, On 7/12/05, Archie Cobbs <[EMAIL PROTECTED]> wrote: > Simon Kitching wrote: > >>>* Class.getName returns strings that have been interned. I don't > >>> think this is explicitly required by the java specs but is > >>> certainly true for Sun's JVM and seems likely to be done by > >>> any sensible JVM. > >> > >>You definitely make some good arguments, but this one is not > >>neccesarily true. In fact, I'd argue a JVM that interns every > >>class' name (even if only on demand) is potentially wasting > >>a bunch of heap space. > > > > I'm assuming that the Class object would contain a reference to the > > interned string, so there is only one copy of the string, ie somewhere > > Not a valid assumtion.. in JC no String is associated with Class > objects. VMClass.getName() is native and the returned String is > created on demand, based on the UTF-8 name stored internally in memory. >
It might also be worthwhile to mention that the internal class name uses slash as a separator, instead of the dot returned by getName(), e.g. java/lang/String, rather than java.lang.String. Rob. _______________________________________________ Classpath mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath

