6733145: (bf) CharBuffer.subSequence can be updated to take advantage of covariant returns
Summary: Change return type to CharBuffer
Reviewed-by: alanb
--- a/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
+++ b/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
@@ -186,7 +186,7 @@
// --- 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);
--- a/jdk/src/share/classes/java/nio/Direct-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
+++ b/jdk/src/share/classes/java/nio/Direct-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
@@ -402,7 +402,7 @@
// --- 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);
--- a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
+++ b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
@@ -566,7 +566,7 @@
// --- 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))
--- a/jdk/src/share/classes/java/nio/StringCharBuffer.java Tue Sep 09 15:20:07 2008 -0700
+++ b/jdk/src/share/classes/java/nio/StringCharBuffer.java Tue Sep 09 15:20:07 2008 -0700
@@ -99,7 +99,7 @@
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,
--- a/jdk/src/share/classes/java/nio/X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java Tue Sep 09 15:20:07 2008 -0700
@@ -1239,13 +1239,13 @@
* 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 ---