summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/PR12350.java
blob: ded8856cf92a0b02d6a872e2314834cf7a77176f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
    }

}