src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
changeset 54129 deb99f13c6cd
parent 54107 1d7aec80147a
child 54151 d2f8b7b33013
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Thu Mar 14 09:35:45 2019 -0700
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Thu Mar 14 09:43:18 2019 -0700
@@ -115,8 +115,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 Heap$Type$Buffer$RW$(hb,
                                         -1,
                                         0,