aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/PR12350.java
diff options
context:
space:
mode:
authorRalph Loader <suckfish@ihug.co.nz>2003-09-22 08:17:49 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2003-09-22 09:17:49 +0100
commit88962108fc1e1e59c4d3f4765cae3f28c03a7745 (patch)
tree3783116e9b94c6400adcc9ebbaeadcf6c20c8887 /libjava/testsuite/libjava.lang/PR12350.java
parentb5bb72ec41b6411a5c7a1f00855cb6d743ab1b7a (diff)
downloadgcc-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.java20
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);
+ }
+
+}