On Thu, 27 Apr 2006 21:03:39 +0200
Edwin Steiner <[EMAIL PROTECTED]> wrote:

> 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;
>        }
>    }
> 

Yes, I know about this from when I was first bootstrapping the generics branch
about 18 months ago.  The fix is on that branch, but obviously hasn't been 
merged
across yet.  I'll try to do so before the release.
-- 
Andrew :-)

Department of Computer Science
University of Sheffield

http://www.dcs.shef.ac.uk/~andrew

Say No2ID - Renew your UK passport in May 2006
http://www.renewforfreedom.org

Attachment: pgpetUESnG66W.pgp
Description: PGP signature

Reply via email to