I've revamped the previous proposed change. Please review the update at
http://cr.openjdk.java.net/~jgish/Bug6206780-sb-append-forward/
<http://cr.openjdk.java.net/%7Ejgish/Bug6206780-sb-append-forward/>
This revision contains the following additions/changes:
1. consistent usage of @Overrides
2. comments on unsynchronized methods depending on other synchronized
methods
3. overall more code coverage of insert, append, indexOf, lastIndexOf,
etc. for both StringBuffer and StringBuilder
4. testing of StringBuffer to ensure that all public un-synchronized
methods are actually synchronized along their call chain. the
StringBuffer/TestSynchronization class uses reflection to decide which
methods to test and could be (with a bit of work on method parameter
setup), be used to test any class for these synchronization properties.
The motivation for this test is to provide some degree of assurance that
modifications to StringBuffer, particularly addition of new methods, do
not break the synchronization contract. The code also includes a
self-test to guard against breaking the test program itself.
Thanks,
Jim
--
Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.g...@oracle.com