diff options
author | Ralph Loader <suckfish@ihug.co.nz> | 2003-09-22 08:17:49 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2003-09-22 09:17:49 +0100 |
commit | 88962108fc1e1e59c4d3f4765cae3f28c03a7745 (patch) | |
tree | 3783116e9b94c6400adcc9ebbaeadcf6c20c8887 /libjava/testsuite/libjava.lang/PR12350.java | |
parent | b5bb72ec41b6411a5c7a1f00855cb6d743ab1b7a (diff) | |
download | gcc-88962108fc1e1e59c4d3f4765cae3f28c03a7745.zip gcc-88962108fc1e1e59c4d3f4765cae3f28c03a7745.tar.gz gcc-88962108fc1e1e59c4d3f4765cae3f28c03a7745.tar.bz2 |
re PR libgcj/12350 (StringBuffer.substring handles shared flag incorrected.)
2003-09-21 Ralph Loader <suckfish@ihug.co.nz>
PR java/12350:
* java/lang/StringBuffer.java (substring): Fix handling of shared
flag.
2003-09-21 Ralph Loader <suckfish@ihug.co.nz>
PR java/12350
* libjava.lang/PR12350.java: New file.
* libjava.lang/PR12350.out: New file.
From-SVN: r71651
Diffstat (limited to 'libjava/testsuite/libjava.lang/PR12350.java')
-rw-r--r-- | libjava/testsuite/libjava.lang/PR12350.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/PR12350.java b/libjava/testsuite/libjava.lang/PR12350.java new file mode 100644 index 0000000..ded8856 --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR12350.java @@ -0,0 +1,20 @@ +public class PR12350 +{ + static public void main (String[] ignored) throws Throwable + { + StringBuffer b = new StringBuffer ("Good string. More than 16 chars."); + + // Should cause sharing. + String s = b.toString(); + + // Take a char by char unshared copy of s. + String t = new String (s.toCharArray()); + + b.substring (0, 4); // BUG: Clears shared flag. + b.replace (0, 4, "Bad "); // Modifies shared data. + + System.out.println (s); + assert s.equals (t); + } + +} |