StringBuXXXX improvements

Martin Buchholz martinrb at google.com
Fri Aug 1 01:18:05 UTC 2008


Hello, String wranglers,

I have updated my proposed StringBu.... changes.
Find them at http://g.oswego.edu/dl/wwwtmp/jsr166/mq/String/patches/
The AbstractStringBuilder performance improvements are now dependent
on the covariant return changes to CharBuffer.subSequence to be found
in subSequenceCovariantReturns.patch.

I have no more performance improvements (in StringPerformance.patch)
in the pipeline.

I reviewed my own spec changes and am tempted to make these further
spec improvements:

- currently the "offset" parameter of the insert(offset,....) overloaded methods
has 3 different names: offset, dstOffset, and index!
I would like to rename these so only one name "offset" is used consistently.

- The paragraph describing offset should be moved into the @throws spec.

    * The {@code offset} argument must be greater than or equal to
     * {@code 0}, and less than or equal to the {@linkplain #length() length}
     * of this sequence.
...................     ......
     * @throws     IndexOutOfBoundsException  if the offset is invalid.

since the constraints will be obvious and uninteresting to most readers.

- all insert(offset ...) methods throw StringIndexOutOfBoundsException,
except for one, which throws plain IndexOutOfBoundsException
I'd like to make this consistent across all methods.

If we have consensus on these changes, I will implement them.

Martin



More information about the core-libs-dev mailing list