This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
classpath-098-merge-branch: Add a new String constructor
- From: Andrew Haley <aph at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Mon, 22 Sep 2008 18:23:26 +0100
- Subject: classpath-098-merge-branch: Add a new String constructor
This is for the new CPStringBuilder.
Andrew.
2008-09-22 Andrew Haley <aph@redhat.com>
* java/lang/String.java (toString(char[], int, int)): New method.
Index: java/lang/String.java
===================================================================
--- java/lang/String.java (revision 140485)
+++ java/lang/String.java (working copy)
@@ -1440,6 +1440,14 @@
return count == 0;
}
+ // Generate a String that shares the value array: subsequent changes
+ // to this array will affect the String. A private internal method
+ // that is called from CPStringBuilder by compiler-generated code.
+ private static String toString(char[] value, int startIndex, int count)
+ {
+ return new String(value, startIndex, count, true);
+ }
+
private native void init(char[] chars, int offset, int count,
boolean dont_copy);
private native void init(byte[] chars, int hibyte, int offset, int count);