提交 74422e53 编写于 作者: M martin

6733145: (bf) CharBuffer.subSequence can be updated to take advantage of covariant returns

Summary: Change return type to CharBuffer
Reviewed-by: alanb
上级 aaee3a0a
......@@ -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 ---
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册