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
[EMAIL PROTECTED]


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to