diff -r a236a9f137ac -r 1376481f15e7 emul/src/main/java/java/lang/String.java --- a/emul/src/main/java/java/lang/String.java Mon Oct 08 17:10:27 2012 -0700 +++ b/emul/src/main/java/java/lang/String.java Tue Oct 16 11:55:56 2012 +0200 @@ -164,7 +164,7 @@ // String itself. Perhaps this constructor is being called // in order to trim the baggage, so make a copy of the array. int off = original.offset; - v = copyOfRange(originalValue, off, off+size); + v = AbstractStringBuilder.copyOfRange(originalValue, off, off+size); } else { // The array representing the String is the same // size as the String, so no point in making a copy. @@ -188,7 +188,7 @@ int size = value.length; this.offset = 0; this.count = size; - this.value = copyOf(value, size); + this.value = AbstractStringBuilder.copyOf(value, size); } /** @@ -225,7 +225,7 @@ } this.offset = 0; this.count = count; - this.value = copyOfRange(value, offset, offset+count); + this.value = AbstractStringBuilder.copyOfRange(value, offset, offset+count); } /** @@ -818,7 +818,7 @@ * This method doesn't perform any range checking. */ void getChars(char dst[], int dstBegin) { - arraycopy(value, offset, dst, dstBegin, count); + AbstractStringBuilder.arraycopy(value, offset, dst, dstBegin, count); } /** @@ -861,7 +861,7 @@ if (srcBegin > srcEnd) { throw new StringIndexOutOfBoundsException(srcEnd - srcBegin); } - arraycopy(value, offset + srcBegin, dst, dstBegin, + AbstractStringBuilder.arraycopy(value, offset + srcBegin, dst, dstBegin, srcEnd - srcBegin); } @@ -3034,32 +3034,4 @@ * guaranteed to be from a pool of unique strings. */ public native String intern(); - - static char[] copyOfRange(char[] original, int from, int to) { - int newLength = to - from; - if (newLength < 0) { - throw new IllegalArgumentException(from + " > " + to); - } - char[] copy = new char[newLength]; - arraycopy(original, from, copy, 0, - Math.min(original.length - from, newLength)); - return copy; - } - static char[] copyOf(char[] original, int newLength) { - char[] copy = new char[newLength]; - arraycopy(original, 0, copy, 0, - Math.min(original.length, newLength)); - return copy; - } - static void arraycopy( - char[] value, int srcBegin, char[] dst, int dstBegin, int count - ) { - while (count-- > 0) { - dst[dstBegin++] = value[srcBegin++]; - } - } - // access system property - static String getProperty(String nm) { - return null; - } }