6733145: (bf) CharBuffer.subSequence can be updated to take advantage of covariant returns
Change return type to CharBuffer Reviewed-by: alanb
This commit is contained in:
parent
77dfe98c4e
commit
3eca12f7b7
@ -186,7 +186,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
|
||||
|
||||
// --- Methods to support CharSequence ---
|
||||
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
public CharBuffer subSequence(int start, int end) {
|
||||
int pos = position();
|
||||
int lim = limit();
|
||||
assert (pos <= lim);
|
||||
|
@ -402,7 +402,7 @@ class Direct$Type$Buffer$RW$$BO$
|
||||
|
||||
// --- Methods to support CharSequence ---
|
||||
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
public CharBuffer subSequence(int start, int end) {
|
||||
int pos = position();
|
||||
int lim = limit();
|
||||
assert (pos <= lim);
|
||||
|
@ -566,7 +566,7 @@ class Heap$Type$Buffer$RW$
|
||||
|
||||
// --- Methods to support CharSequence ---
|
||||
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
public CharBuffer subSequence(int start, int end) {
|
||||
if ((start < 0)
|
||||
|| (end > length())
|
||||
|| (start > end))
|
||||
|
@ -99,7 +99,7 @@ class StringCharBuffer // package-private
|
||||
return str.toString().substring(start + offset, end + offset);
|
||||
}
|
||||
|
||||
public final CharSequence subSequence(int start, int end) {
|
||||
public final CharBuffer subSequence(int start, int end) {
|
||||
try {
|
||||
int pos = position();
|
||||
return new StringCharBuffer(str, -1,
|
||||
|
@ -1239,13 +1239,13 @@ public abstract class $Type$Buffer
|
||||
* smaller than <tt>start</tt> and no larger than
|
||||
* <tt>remaining()</tt>
|
||||
*
|
||||
* @return The new character sequence
|
||||
* @return The new character buffer
|
||||
*
|
||||
* @throws IndexOutOfBoundsException
|
||||
* If the preconditions on <tt>start</tt> and <tt>end</tt>
|
||||
* do not hold
|
||||
*/
|
||||
public abstract CharSequence subSequence(int start, int end);
|
||||
public abstract CharBuffer subSequence(int start, int end);
|
||||
|
||||
|
||||
// --- Methods to support Appendable ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user