bootstrapping problem with StringBuilder

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

 



Hello classpath hackers!

I'm testing cacao with an "ecj -target 1.5"-compiled classpath in
addition to the jikes-compiled classpath I normally use. With ecj I
ran into a bootstrapping problem that made both cacao and jamvm fail:

What makes the difference is that ecj uses StringBuilder instead of
StringBuffer in gnu/classpath/SystemProperties.<clinit>()V.

StringBuilder uses System.arraycopy, which in turn requires executing
System.<clinit>, which indirectly needs gnu/classpath/SystemProperties.getProperty,
which in turn throws a NullPointerException because the system
properties have not yet been initialized.

A solution to this is to use VMSystem.arraycopy instead of
System.arraycopy. (StringBuffer already does that.)

Cheers
-Edwin

Index: java/lang/StringBuilder.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/StringBuilder.java,v
retrieving revision 1.7
diff -u -p -r1.7 StringBuilder.java
--- java/lang/StringBuilder.java	2 Mar 2006 20:18:44 -0000	1.7
+++ java/lang/StringBuilder.java	27 Apr 2006 19:03:02 -0000
@@ -206,7 +206,7 @@ public final class StringBuilder
         int max = value.length * 2 + 2;
         minimumCapacity = (minimumCapacity < max ? max : minimumCapacity);
         char[] nb = new char[minimumCapacity];
-        System.arraycopy(value, 0, nb, 0, count);
+        VMSystem.arraycopy(value, 0, nb, 0, count);
         value = nb;
       }
   }


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux