[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String/Hashtable bootstrapping problem

From: Patrick Doyle
Subject: Re: String/Hashtable bootstrapping problem
Date: Thu, 5 Jul 2001 22:01:54 -0400 (EDT)

On Thu, 5 Jul 2001, John Leuner wrote:

> > I have encountered a problem trying to initialize the String and Hashtable
> > classes.  Here's the problem:
> > 
> > - Hashtable uses String constants like "loadFactor" and "threshold" which
> >   are initialized in Hashtable.<clinit>.
> You are mistaken, these are primitive types (ints and floats).

I'm talking about these lines from java.util.Hashtable:

  // used for serializing instances of this class
  private static final ObjectStreamField[] serialPersistentFields =
    { new ObjectStreamField("loadFactor", float.class),
      new ObjectStreamField("threshold", int.class) };

This leads to LDC instructions in Hashtable.<clinit> which grab the
strings "loadFactor" and "threshold" from the constant pool.  To make
these strings, I need to have initialized java.lang.String and to call the
"intern" function, which requires the Hashtable to be initialized, etc.

Of course, these things are private and they're never used in the class.
Why are they there?  Are they accessed by reflection during serialization?
Maybe I'll just comment them out for now.

Patrick Doyle

reply via email to

[Prev in Thread] Current Thread [Next in Thread]