src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
changeset 54129 deb99f13c6cd
parent 53959 1542e63eb537
child 54151 d2f8b7b33013
--- a/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template	Thu Mar 14 09:35:45 2019 -0700
+++ b/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template	Thu Mar 14 09:43:18 2019 -0700
@@ -87,8 +87,7 @@
 
     @Override
     public $Type$Buffer slice(int index, int length) {
-        Objects.checkIndex(index, limit() + 1);
-        Objects.checkIndex(length, limit() - index + 1);
+        Objects.checkFromIndexSize(index, length, limit());
         return new ByteBufferAs$Type$Buffer$RW$$BO$(bb,
                                                     -1,
                                                     0,