The changes look OK.

The needs of mutable CharSequences to isolate the subsequence changes seems 
adequately handled in the mutable classes.

Mike

On Dec 3 2013, at 10:15 , Stuart Marks <[email protected]> wrote:

> Hi all,
> 
> Please review this small change to the subSequence() method specs of 
> CharSequence and String. Essentially this removes the requirement of 
> returning a "new" character sequence at each call. This brings the spec in 
> line with String's implementation, which will return 'this' in appropriate 
> circumstances.
> 
> No change is necessary for the other CharSequence implementations. 
> StringBuilder/Buffer still say "new" and in fact they always return new 
> String objects. CharBuffer defines its exact sharing behavior. Segment 
> returns a "new" Segment with a shared character array, which is (supposedly) 
> immutable.
> 
> Diffs appended below.
> 
> Thanks,
> 
> s'marks
> 
> 
> # HG changeset patch
> # User smarks
> # Date 1386094056 28800
> # Node ID c15e257074e48a1927755ff48393baa8f3f3ab0e
> # Parent  4d9078b1f25b72071d91acc7e1ce5bb7e91748fb
> 8028757: CharSequence.subSequence improperly requires a "new" CharSequence be 
> returned
> Reviewed-by: XXX
> 
> diff -r 4d9078b1f25b -r c15e257074e4 
> src/share/classes/java/lang/CharSequence.java
> --- a/src/share/classes/java/lang/CharSequence.java   Tue Nov 26 14:49:55 
> 2013 +0900
> +++ b/src/share/classes/java/lang/CharSequence.java   Tue Dec 03 10:07:36 
> 2013 -0800
> @@ -87,7 +87,7 @@
>     char charAt(int index);
> 
>     /**
> -     * Returns a new <code>CharSequence</code> that is a subsequence of this 
> sequence.
> +     * Returns a <code>CharSequence</code> that is a subsequence of this 
> sequence.
>      * The subsequence starts with the <code>char</code> value at the 
> specified index and
>      * ends with the <code>char</code> value at index <tt>end - 1</tt>.  The 
> length
>      * (in <code>char</code>s) of the
> diff -r 4d9078b1f25b -r c15e257074e4 src/share/classes/java/lang/String.java
> --- a/src/share/classes/java/lang/String.java Tue Nov 26 14:49:55 2013 +0900
> +++ b/src/share/classes/java/lang/String.java Tue Dec 03 10:07:36 2013 -0800
> @@ -1958,7 +1958,7 @@
>     }
> 
>     /**
> -     * Returns a new character sequence that is a subsequence of this 
> sequence.
> +     * Returns a character sequence that is a subsequence of this sequence.
>      *
>      * <p> An invocation of this method of the form
>      *

Reply via email to