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:
Martin Buchholz 2008-09-09 15:20:07 -07:00
parent 77dfe98c4e
commit 3eca12f7b7
5 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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))

View File

@ -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,

View File

@ -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 ---