You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2022/12/16 00:38:51 UTC

[datasketches-memory] branch IntegrateJava17_v2 updated: At this point all isolated Java "assert" methods have been removed from both main and test code. Leaving, of course, all the TestNG asserts.

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch IntegrateJava17_v2
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git


The following commit(s) were added to refs/heads/IntegrateJava17_v2 by this push:
     new 5c68e0c  At this point all isolated Java "assert" methods have been removed from both main and test code. Leaving, of course, all the TestNG asserts.
5c68e0c is described below

commit 5c68e0c10b4ee5869baf306a320087caaa9367ab
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Thu Dec 15 16:38:37 2022 -0800

    At this point all isolated Java "assert" methods have been removed from
    both main and test code. Leaving, of course, all the TestNG asserts.
    
    Also some cleanup where I found it.
---
 .../memory/internal/BaseBufferImpl.java            |   2 +-
 .../memory/internal/BaseStateImpl.java             |  51 ++++++----
 .../memory/internal/BaseWritableBufferImpl.java    |   6 +-
 .../memory/internal/BaseWritableMemoryImpl.java    |  11 +--
 .../memory/internal/NativeWritableBufferImpl.java  |   7 +-
 .../memory/internal/NativeWritableMemoryImpl.java  |   8 +-
 .../internal/NonNativeWritableBufferImpl.java      |   8 +-
 .../internal/NonNativeWritableMemoryImpl.java      |   8 +-
 .../apache/datasketches/memory/internal/Util.java  |  40 ++++++++
 .../memory/internal/BaseStateTest.java             |   2 +-
 .../internal/NativeWritableBufferImplTest.java     |   2 +-
 .../internal/NativeWritableMemoryImplTest.java     |   2 +-
 .../org/apache/datasketches/memory/BaseBuffer.java |  29 ------
 .../datasketches/memory/BoundsException.java       |  19 ++++
 .../datasketches/memory/MemoryException.java       |   9 ++
 .../memory/internal/AllocateDirect.java            |   2 +-
 .../memory/internal/AllocateDirectMap.java         |   9 +-
 .../internal/BBNonNativeWritableBufferImpl.java    |   6 +-
 .../internal/BBNonNativeWritableMemoryImpl.java    |   6 +-
 .../memory/internal/BBWritableBufferImpl.java      |   6 +-
 .../memory/internal/BBWritableMemoryImpl.java      |   6 +-
 .../memory/internal/BaseBufferImpl.java            |  70 +------------
 .../memory/internal/BaseStateImpl.java             | 108 ++++++++-------------
 .../memory/internal/BaseWritableBufferImpl.java    |  75 ++++++--------
 .../memory/internal/BaseWritableMemoryImpl.java    |  52 ++++------
 .../DirectNonNativeWritableBufferImpl.java         |   2 +-
 .../DirectNonNativeWritableMemoryImpl.java         |   2 +-
 .../memory/internal/DirectWritableBufferImpl.java  |   2 +-
 .../memory/internal/DirectWritableMemoryImpl.java  |   2 +-
 .../memory/internal/NativeWritableBufferImpl.java  |  43 +++-----
 .../memory/internal/NativeWritableMemoryImpl.java  |  40 +++-----
 .../internal/NonNativeWritableBufferImpl.java      |  41 +++-----
 .../internal/NonNativeWritableMemoryImpl.java      |  38 +++-----
 .../apache/datasketches/memory/package-info.java   |   3 +-
 .../internal/AllocateDirectMapMemoryTest.java      |  10 +-
 .../memory/internal/BaseBufferTest.java            |  19 ++--
 .../memory/internal/BaseStateTest.java             |   5 +-
 .../datasketches/memory/internal/Buffer2Test.java  |  28 +++---
 .../memory/internal/BufferBoundaryCheckTest.java   |  77 +++++++--------
 .../memory/internal/BufferInvariantsTest.java      |  47 ++++-----
 .../memory/internal/BufferReadWriteSafetyTest.java |  38 ++++----
 .../datasketches/memory/internal/BufferTest.java   |  22 ++---
 .../memory/internal/CommonBufferTest.java          |  12 +--
 .../memory/internal/MemoryBoundaryCheckTest.java   |  65 +++++++------
 .../memory/internal/MemoryReadWriteSafetyTest.java |  51 +++++-----
 .../datasketches/memory/internal/MemoryTest.java   |   4 +-
 .../memory/internal/MemoryWriteToTest.java         |   8 +-
 .../internal/NativeWritableBufferImplTest.java     |  13 +--
 .../internal/NativeWritableMemoryImplTest.java     |  21 ++--
 .../internal/NonNativeWritableBufferImplTest.java  |  36 +++----
 .../internal/NonNativeWritableMemoryImplTest.java  |  13 +--
 .../memory/internal/SpecificLeafTest.java          |   2 +-
 .../datasketches/memory/internal/Utf8Test.java     |   9 +-
 .../datasketches/memory/internal/UtilTest.java     |   3 +-
 .../memory/internal/VirtualMachineMemoryTest.java  |  19 ++--
 .../memory/internal/WritableDirectCopyTest.java    |  11 ++-
 56 files changed, 564 insertions(+), 666 deletions(-)

diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseBufferImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseBufferImpl.java
index 5d50d7c..8c2e896 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseBufferImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseBufferImpl.java
@@ -48,7 +48,7 @@ abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer {
   private long pos = 0;
   private long end;
 
-  //Pass-through ctor
+  //Pass-through constructor
   BaseBufferImpl(
       final MemorySegment seg,
       final int typeId,
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseStateImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseStateImpl.java
index 78ec304..55e1c8a 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseStateImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseStateImpl.java
@@ -20,6 +20,7 @@
 package org.apache.datasketches.memory.internal;
 
 import static jdk.incubator.foreign.MemoryAccess.getByteAtOffset;
+import static org.apache.datasketches.memory.internal.Util.characterPad;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
@@ -94,8 +95,14 @@ abstract class BaseStateImpl implements BaseState {
   final MemorySegment seg;
   final int typeId;
 
-  MemoryRequestServer memReqSvr;
+  MemoryRequestServer memReqSvr; //selected by the user
 
+  /**
+   * Constructor
+   * @param seg the MemorySegment
+   * @param typeId identifies the type parameters for this Memory
+   * @param memReqSvr the MemoryRequestServer
+   */
   BaseStateImpl(final MemorySegment seg, final int typeId, final MemoryRequestServer memReqSvr) {
     this.seg = seg;
     this.typeId = typeId;
@@ -128,6 +135,10 @@ abstract class BaseStateImpl implements BaseState {
     }
   }
 
+  static String pad(final String s, final int fieldLen) {
+    return characterPad(s, fieldLen, ' ' , true);
+  }
+
   /**
    * Returns first two number groups of the java version string.
    * @param jdkVer the java version string from System.getProperty("java.version").
@@ -242,42 +253,40 @@ abstract class BaseStateImpl implements BaseState {
     final StringBuilder sb = new StringBuilder();
     final int group1 = typeId & 0x7;
     switch (group1) { // 0000 0XXX
-      case 0 : sb.append("Writable:\t"); break;
-      case 1 : sb.append("ReadOnly:\t"); break;
-      case 2 : sb.append("Writable:\tRegion:\t"); break;
-      case 3 : sb.append("ReadOnly:\tRegion:\t"); break;
-      case 4 : sb.append("Writable:\tDuplicate:\t"); break;
-      case 5 : sb.append("ReadOnly:\tDuplicate:\t"); break;
-      case 6 : sb.append("Writable:\tRegion:\tDuplicate:\t"); break;
-      case 7 : sb.append("ReadOnly:\tRegion:\tDuplicate:\t"); break;
+      case 0 : sb.append(pad("Writable + ",32)); break;
+      case 1 : sb.append(pad("ReadOnly + ",32)); break;
+      case 2 : sb.append(pad("Writable + Region + ",32)); break;
+      case 3 : sb.append(pad("ReadOnly + Region + ",32)); break;
+      case 4 : sb.append(pad("Writable + Duplicate + ",32)); break;
+      case 5 : sb.append(pad("ReadOnly + Duplicate + ",32)); break;
+      case 6 : sb.append(pad("Writable + Region + Duplicate + ",32)); break;
+      case 7 : sb.append(pad("ReadOnly + Region + Duplicate + ",32)); break;
       default: break;
     }
     final int group2 = (typeId >>> 3) & 0x3;
     switch (group2) { // 000X X000
-      case 0 : sb.append("Heap:\t"); break;
-      case 1 : sb.append("Direct:\t"); break;
-      case 2 : sb.append("Map:\t"); break;
-      case 3 : sb.append("Direct:\tMap:\t"); break;
+      case 0 : sb.append(pad("Heap + ",15)); break;
+      case 1 : sb.append(pad("Direct + ",15)); break;
+      case 2 : sb.append(pad("Map + Direct + ",15)); break;
+      case 3 : sb.append(pad("Map + Direct + ",15)); break;
       default: break;
     }
-    if ((typeId & BYTEBUF) > 0) { sb.append("ByteBuffer:\t"); }
-
     final int group3 = (typeId >>> 5) & 0x1;
     switch (group3) { // 00X0 0000
-      case 0 : sb.append("NativeOrder:\t"); break;
-      case 1 : sb.append("NonNativeOrder:\t"); break;
+      case 0 : sb.append(pad("NativeOrder + ",17)); break;
+      case 1 : sb.append(pad("NonNativeOrder + ",17)); break;
       default: break;
     }
     final int group4 = (typeId >>> 6) & 0x1;
     switch (group4) { // 0X00 0000
-      case 0 : sb.append("Memory:\t"); break;
-      case 1 : sb.append("Buffer:\t"); break;
+      case 0 : sb.append(pad("Memory + ",9)); break;
+      case 1 : sb.append(pad("Buffer + ",9)); break;
       default: break;
     }
     final int group5 = (typeId >>> 7) & 0x1;
     switch (group5) { // X000 0000
-      case 0 : sb.append(""); break;
-      case 1 : sb.append("ByteBuffer"); break;
+      case 0 : sb.append(pad("",10)); break;
+      case 1 : sb.append(pad("ByteBuffer",10)); break;
       default: break;
     }
     return sb.toString();
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
index a92e75c..8692aa0 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
@@ -74,7 +74,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
     if (localReadOnly) {
       if (byteBuffer.isReadOnly()) {
         byteBuf = byteBuffer.duplicate();
-      } else { //bb writable
+      } else { //ByteBuffer writable
         byteBuf = byteBuffer.asReadOnlyBuffer();
       }
     } else { //want writable
@@ -236,7 +236,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
     return wmem;
   }
 
-  //PRIMITIVE getX() and getXArray()
+  //PRIMITIVE getX() and getXArray() that are Byte Order insensitive
 
   @Override
   public final boolean getBoolean() {
@@ -285,7 +285,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
    * the positional values. Switch to asMemory view to do copyTo.
    */
 
-  //PRIMITIVE putX() and putXArray() implementations
+  //PRIMITIVE putX() and putXArray() that are Byte Order insensitive
 
   @Override
   public final void putBoolean(final boolean value) {
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
index 8b07ab9..a0ca068 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
@@ -266,7 +266,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
     return wbuf;
   }
 
-  //PRIMITIVE getX() and getXArray()
+  //PRIMITIVE getX() and getXArray() that are Byte Order insensitive
 
   @Override
   public final boolean getBoolean(final long offsetBytes) {
@@ -278,10 +278,9 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
     return MemoryAccess.getByteAtOffset(seg, offsetBytes);
   }
 
-  @Override //Efficient handling of arrays is fundamental limitation of MemorySegment in Java17
+  @Override
   public final void getByteArray(final long offsetBytes, final byte[] dstArray,
       final int dstOffsetBytes, final int lengthBytes) {
-    checkBounds(dstOffsetBytes, lengthBytes, dstArray.length);
     final MemorySegment srcSlice = seg.asSlice(offsetBytes, lengthBytes); //view
     final MemorySegment dstSlice = MemorySegment.ofArray(dstArray).asSlice(dstOffsetBytes, lengthBytes);
     dstSlice.copyFrom(srcSlice);
@@ -297,8 +296,8 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
   }
 
   @Override
-  public final void copyTo(final long srcOffsetBytes,
-      final WritableMemory destination, final long dstOffsetBytes, final long lengthBytes) {
+  public final void copyTo(final long srcOffsetBytes, final WritableMemory destination,
+      final long dstOffsetBytes, final long lengthBytes) {
     CompareAndCopy.copy(seg, srcOffsetBytes,
         ((BaseStateImpl)destination).seg, dstOffsetBytes, lengthBytes);
   }
@@ -312,7 +311,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
     out.writeBytes(bArr);
   }
 
-  //  //PRIMITIVE putX() and putXArray() implementations
+  //PRIMITIVE putX() and putXArray() that are Byte Order insensitive
 
   @Override
   public final void putBoolean(final long offsetBytes, final boolean value) {
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
index c622766..226e665 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
@@ -45,6 +45,7 @@ import jdk.incubator.foreign.MemorySegment;
  */
 final class NativeWritableBufferImpl extends BaseWritableBufferImpl {
 
+  //Leaf constructor
   NativeWritableBufferImpl(
       final MemorySegment seg,
       final int typeId,
@@ -52,7 +53,8 @@ final class NativeWritableBufferImpl extends BaseWritableBufferImpl {
     super(seg, typeId, memReqSvr);
   }
 
-  //PRIMITIVE getX() and getXArray()
+  //PRIMITIVE getX() and getXArray() that are Byte Order sensitive
+
   @Override
   public char getChar() {
     final long pos = getPosition();
@@ -185,7 +187,8 @@ final class NativeWritableBufferImpl extends BaseWritableBufferImpl {
     setPosition(pos + copyBytes);
   }
 
-  //PRIMITIVE putX() and putXArray()
+  //PRIMITIVE putX() and putXArray() that are Byte Order sensitive
+
   @Override
   public void putChar(final char value) {
     final long pos = getPosition();
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
index 41cb9b6..4a7a32e 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
@@ -44,7 +44,7 @@ import jdk.incubator.foreign.MemorySegment;
  */
 final class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
-  //Pass-through ctor
+  //Leaf constructor
   NativeWritableMemoryImpl(
       final MemorySegment seg,
       final int typeId,
@@ -52,7 +52,8 @@ final class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
     super(seg, typeId, memReqSvr);
   }
 
-  ///PRIMITIVE getX() and getXArray()
+  //PRIMITIVE getX() and getXArray() that are Byte Order sensitive
+
   @Override
   public char getChar(final long offsetBytes) {
     return MemoryAccess.getCharAtOffset(seg, offsetBytes);
@@ -137,7 +138,8 @@ final class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
     dstSlice.copyFrom(srcSlice);
   }
 
-  //PRIMITIVE putX() and putXArray() implementations
+  //PRIMITIVE putX() and putXArray() that are Byte Order sensitive.
+
   @Override
   public void putChar(final long offsetBytes, final char value) {
     MemoryAccess.setCharAtOffset(seg, offsetBytes, value);
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
index a27878e..f614d7b 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
@@ -45,7 +45,7 @@ import jdk.incubator.foreign.MemorySegment;
  */
 final class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
 
-  //Pass-through ctor
+  //Leaf constructor
   NonNativeWritableBufferImpl(
       final MemorySegment seg,
       final int typeId,
@@ -53,7 +53,8 @@ final class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
     super(seg, typeId, memReqSvr);
   }
 
-  //PRIMITIVE getX() and getXArray()
+  //PRIMITIVE getX() and getXArray() that are Byte Order sensitive
+
   @Override
   public char getChar() {
     final long pos = getPosition();
@@ -207,7 +208,8 @@ final class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
     setPosition(pos + copyBytes);
   }
 
-  //PRIMITIVE putX() and putXArray()
+  //PRIMITIVE putX() and putXArray() that are Byte Order sensitive
+
   @Override
   public void putChar(final char value) {
     final long pos = getPosition();
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
index c699e8e..f334e18 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
@@ -44,7 +44,7 @@ import jdk.incubator.foreign.MemorySegment;
  */
 final class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
-  //Pass-through ctor
+  //Leaf constructor
   NonNativeWritableMemoryImpl(
       final MemorySegment seg,
       final int typeId,
@@ -52,7 +52,8 @@ final class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
     super(seg, typeId, memReqSvr);
   }
 
-  ///PRIMITIVE getX() and getXArray()
+  ///PRIMITIVE getX() and getXArray() that are Byte Order sensitive
+
   @Override
   public char getChar(final long offsetBytes) {
     return MemoryAccess.getCharAtOffset(seg, offsetBytes, NON_NATIVE_BYTE_ORDER);
@@ -155,7 +156,8 @@ final class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
     }
   }
 
-  //PRIMITIVE putX() and putXArray() implementations
+  //PRIMITIVE putX() and putXArray() implementations that are Byte Order sensitive
+
   @Override
   public void putChar(final long offsetBytes, final char value) {
     MemoryAccess.setCharAtOffset(seg, offsetBytes, NON_NATIVE_BYTE_ORDER, value);
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/Util.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/Util.java
index 27e2fac..75466bb 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/Util.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/internal/Util.java
@@ -38,6 +38,46 @@ final class Util {
 
   private Util() { }
 
+  /**
+   * Prepend or postpend the given string with the given character to fill the given field length.
+   * If the given string is equal or greater than the given field length, it will be returned
+   * without modification.
+   * @param s the given string
+   * @param fieldLength the desired field length
+   * @param padChar the desired pad character
+   * @param postpend if true append the pacCharacters to the end of the string.
+   * @return prepended or postpended given string with the given character to fill the given field
+   * length.
+   */
+  public static final String characterPad(final String s, final int fieldLength,
+      final char padChar, final boolean postpend) {
+    final char[] chArr = s.toCharArray();
+    final int sLen = chArr.length;
+    if (sLen < fieldLength) {
+      final char[] out = new char[fieldLength];
+      final int blanks = fieldLength - sLen;
+
+      if (postpend) {
+        for (int i = 0; i < sLen; i++) {
+          out[i] = chArr[i];
+        }
+        for (int i = sLen; i < fieldLength; i++) {
+          out[i] = padChar;
+        }
+      } else { //prepend
+        for (int i = 0; i < blanks; i++) {
+          out[i] = padChar;
+        }
+        for (int i = blanks; i < fieldLength; i++) {
+          out[i] = chArr[i - blanks];
+        }
+      }
+
+      return String.valueOf(out);
+    }
+    return s;
+  }
+
   /**
    * Return true if all the masked bits of value are zero
    * @param value the value to be tested
diff --git a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/BaseStateTest.java b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/BaseStateTest.java
index 181afc2..793cc8b 100644
--- a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/BaseStateTest.java
+++ b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/BaseStateTest.java
@@ -134,7 +134,7 @@ public class BaseStateTest {
    * @param s value to print
    */
   static void println(String s) {
-    //System.out.println(s); //disable here
+    System.out.println(s); //disable here
   }
 
 }
diff --git a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
index dd4d398..142091e 100644
--- a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
+++ b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
@@ -45,7 +45,7 @@ public class NativeWritableBufferImplTest {
 
   //Simple Native direct
 
-  @SuppressWarnings("resource")
+  //@SuppressWarnings("resource")
   @Test
   public void checkNativeCapacityAndClose() throws Exception {
     int memCapacity = 64;
diff --git a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
index 9c56ab6..c0768ff 100644
--- a/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
+++ b/datasketches-memory-java17/src/test/java17/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
@@ -44,7 +44,7 @@ public class NativeWritableMemoryImplTest {
 
   //Simple Native direct
 
-  @SuppressWarnings("resource")
+  //@SuppressWarnings("resource")
   @Test
   public void checkNativeCapacityAndClose() throws Exception {
     int memCapacity = 64;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
index 9cd824e..4b856ee 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
@@ -38,15 +38,6 @@ package org.apache.datasketches.memory;
  */
 public interface BaseBuffer extends BaseState {
 
-  /**
-   * Increments the current position by the given increment.
-   * Asserts that the resource is valid and that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param increment the given increment
-   * @return BaseBuffer
-   */
-  BaseBuffer incrementPosition(long increment);
-
   /**
    * Increments the current position by the given increment.
    * Checks that the resource is valid and that the positional invariants are not violated,
@@ -93,15 +84,6 @@ public interface BaseBuffer extends BaseState {
    */
   BaseBuffer resetPosition();
 
-  /**
-   * Sets the current position.
-   * Asserts that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param position the given current position.
-   * @return BaseBuffer
-   */
-  BaseBuffer setPosition(long position);
-
   /**
    * Sets the current position.
    * Checks that the positional invariants are not violated,
@@ -111,17 +93,6 @@ public interface BaseBuffer extends BaseState {
    */
   BaseBuffer setAndCheckPosition(long position);
 
-  /**
-   * Sets start position, current position, and end position.
-   * Asserts that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param start the start position in the buffer
-   * @param position the current position between the start and end
-   * @param end the end position in the buffer
-   * @return BaseBuffer
-   */
-  BaseBuffer setStartPositionEnd(long start, long position, long end);
-
   /**
    * Sets start position, current position, and end position.
    * Checks that the positional invariants are not violated,
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BoundsException.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BoundsException.java
new file mode 100644
index 0000000..c2ab5b3
--- /dev/null
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BoundsException.java
@@ -0,0 +1,19 @@
+package org.apache.datasketches.memory;
+
+/**
+ * Specifically used for detecting index bounds violations.
+ *
+ * @author Lee Rhodes
+ */
+public class BoundsException extends MemoryException {
+  static final long serialVersionUID = 9001L; //prime
+
+  public BoundsException() {
+    super();
+  }
+
+  public BoundsException(String message) {
+    super(message);
+  }
+
+}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
index 6b3663c..5311a9a 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
@@ -28,6 +28,15 @@ package org.apache.datasketches.memory;
 public class MemoryException extends RuntimeException {
   private static final long serialVersionUID = 1L;
 
+  /**
+   * Constructs a new runtime exception. The cause is not
+   * initialized, and may subsequently be initialized by a call to
+   * Throwable.initCause(java.lang.Throwable).
+   */
+  public MemoryException() {
+    super();
+  }
+
   /**
    * Constructs a new runtime exception with the specified detail message. The cause is not
    * initialized, and may subsequently be initialized by a call to
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
index 64fe4fa..833cd06 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
@@ -103,7 +103,7 @@ final class AllocateDirect {
       this.nativeAddress = nativeAddress;
       this.allocationSize = allocationSize;
       this.capacity = capacity;
-      assert (nativeAddress != 0);
+      if (nativeAddress == 0) { throw new IllegalStateException("Native address must not be zero."); }
     }
 
     StepBoolean getValid() {
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
index a69f958..7c3758b 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
@@ -32,6 +32,7 @@ import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
 import java.util.logging.Logger;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Map;
 import org.apache.datasketches.memory.MemoryCloseException;
 
@@ -110,7 +111,7 @@ class AllocateDirectMap implements Map {
     resourceReadOnly = isFileReadOnly(file);
     final long fileLength = file.length();
     if ((localReadOnly || resourceReadOnly) && fileOffsetBytes + capacityBytes > fileLength) {
-      throw new IllegalArgumentException(
+      throw new BoundsException(
           "Read-only mode and requested map length is greater than current file length: "
           + "Requested Length = " + (fileOffsetBytes + capacityBytes)
           + ", Current File Length = " + fileLength);
@@ -262,12 +263,12 @@ class AllocateDirectMap implements Map {
     Deallocator(final long nativeBaseOffset, final long capacityBytes,
         final RandomAccessFile raf) {
       myRaf = raf;
-      assert myRaf != null;
+      if (myRaf == null) { throw new IllegalStateException("RandomAccessFile must not be null."); }
       myFc = myRaf.getChannel();
       actualNativeBaseOffset = nativeBaseOffset;
-      assert actualNativeBaseOffset != 0;
+      if (actualNativeBaseOffset == 0) { throw new IllegalStateException(" Native Base Offset must not be zero."); }
       myCapacity = capacityBytes;
-      assert myCapacity != 0;
+      if (myCapacity == 0) { throw new IllegalStateException("The capacity of this map must not be zero."); }
     }
 
     StepBoolean getValid() {
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java
index 8fbce11..431063c 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java
@@ -88,13 +88,13 @@ final class BBNonNativeWritableBufferImpl extends NonNativeWritableBufferImpl {
 
   @Override
   public ByteBuffer getByteBuffer() {
-    assertValid();
+    checkValid();
     return byteBuf;
   }
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
@@ -110,7 +110,7 @@ final class BBNonNativeWritableBufferImpl extends NonNativeWritableBufferImpl {
 
   @Override
   Object getUnsafeObject() {
-    assertValid();
+    checkValid();
     return unsafeObj;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java
index 60ed085..f119924 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java
@@ -78,13 +78,13 @@ final class BBNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl {
 
   @Override
   public ByteBuffer getByteBuffer() {
-    assertValid();
+    checkValid();
     return byteBuf;
   }
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
@@ -100,7 +100,7 @@ final class BBNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl {
 
   @Override
   Object getUnsafeObject() {
-    assertValid();
+    checkValid();
     return unsafeObj;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java
index 0288488..dd25f1d 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java
@@ -88,13 +88,13 @@ final class BBWritableBufferImpl extends NativeWritableBufferImpl {
 
   @Override
   public ByteBuffer getByteBuffer() {
-    assertValid();
+    checkValid();
     return byteBuf;
   }
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
@@ -110,7 +110,7 @@ final class BBWritableBufferImpl extends NativeWritableBufferImpl {
 
   @Override
   Object getUnsafeObject() {
-    assertValid();
+    checkValid();
     return unsafeObj;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java
index ad06dc9..7b4d87a 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java
@@ -78,13 +78,13 @@ final class BBWritableMemoryImpl extends NativeWritableMemoryImpl {
 
   @Override
   public ByteBuffer getByteBuffer() {
-    assertValid();
+    checkValid();
     return byteBuf;
   }
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
@@ -100,7 +100,7 @@ final class BBWritableMemoryImpl extends NativeWritableMemoryImpl {
 
   @Override
   Object getUnsafeObject() {
-    assertValid();
+    checkValid();
     return unsafeObj;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseBufferImpl.java
index 7bc1340..19664c8 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseBufferImpl.java
@@ -20,6 +20,7 @@
 package org.apache.datasketches.memory.internal;
 
 import org.apache.datasketches.memory.BaseBuffer;
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.ReadOnlyException;
 
 /**
@@ -45,22 +46,16 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
   private long pos = 0;
   private long end;
 
-  //Pass-through ctor
+  //Pass-through constructor
   BaseBufferImpl(final Object unsafeObj, final long nativeBaseOffset,
       final long regionOffset, final long capacityBytes) {
     super(unsafeObj, nativeBaseOffset, regionOffset, capacityBytes);
     capacity = end = capacityBytes;
   }
 
-  @Override
-  public final BaseBufferImpl incrementPosition(final long increment) {
-    incrementAndAssertPositionForRead(pos, increment);
-    return this;
-  }
-
   @Override
   public final BaseBufferImpl incrementAndCheckPosition(final long increment) {
-    incrementAndCheckPositionForRead(pos, increment);
+    incrementAndCheckPosition(pos, increment);
     return this;
   }
 
@@ -95,13 +90,6 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
     return this;
   }
 
-  @Override
-  public final BaseBufferImpl setPosition(final long position) {
-    assertInvariants(start, position, end, capacity);
-    pos = position;
-    return this;
-  }
-
   @Override
   public final BaseBufferImpl setAndCheckPosition(final long position) {
     checkInvariants(start, position, end, capacity);
@@ -109,16 +97,6 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
     return this;
   }
 
-  @Override
-  public final BaseBufferImpl setStartPositionEnd(final long start, final long position,
-      final long end) {
-    assertInvariants(start, position, end, capacity);
-    this.start = start;
-    this.end = end;
-    pos = position;
-    return this;
-  }
-
   @Override
   public final BaseBufferImpl setAndCheckStartPositionEnd(final long start, final long position,
       final long end) {
@@ -130,25 +108,9 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
   }
 
   //RESTRICTED
-  //Position checks are only used for Buffers
-  //asserts are used for primitives, not used at runtime
-  final void incrementAndAssertPositionForRead(final long position, final long increment) {
-    assertValid();
-    final long newPos = position + increment;
-    assertInvariants(start, newPos, end, capacity);
-    pos = newPos;
-  }
-
-  final void incrementAndAssertPositionForWrite(final long position, final long increment) {
-    assertValid();
-    assert !isReadOnly() : "BufferImpl is read-only.";
-    final long newPos = position + increment;
-    assertInvariants(start, newPos, end, capacity);
-    pos = newPos;
-  }
 
   //checks are used for arrays and apply at runtime
-  final void incrementAndCheckPositionForRead(final long position, final long increment) {
+  final void incrementAndCheckPosition(final long position, final long increment) {
     checkValid();
     final long newPos = position + increment;
     checkInvariants(start, newPos, end, capacity);
@@ -169,28 +131,6 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
     }
   }
 
-  /**
-   * The invariants equation is: {@code 0 <= start <= position <= end <= capacity}.
-   * If this equation is violated and assertions are enabled,
-   * an <i>AssertionError</i> will be thrown.
-   * @param start the lowest start position
-   * @param pos the current position
-   * @param end the highest position
-   * @param cap the capacity of the backing buffer.
-   */
-  static final void assertInvariants(final long start, final long pos, final long end,
-      final long cap) {
-    assert (start | pos | end | cap | (pos - start) | (end - pos) | (cap - end) ) >= 0L
-        : "Violation of Invariants: "
-        + "start: " + start
-        + " <= pos: " + pos
-        + " <= end: " + end
-        + " <= cap: " + cap
-        + "; (pos - start): " + (pos - start)
-        + ", (end - pos): " + (end - pos)
-        + ", (cap - end): " + (cap - end);
-  }
-
   /**
    * The invariants equation is: {@code 0 <= start <= position <= end <= capacity}.
    * If this equation is violated an <i>IllegalArgumentException</i> will be thrown.
@@ -202,7 +142,7 @@ public abstract class BaseBufferImpl extends BaseStateImpl implements BaseBuffer
   static final void checkInvariants(final long start, final long pos, final long end,
         final long cap) {
     if ((start | pos | end | cap | (pos - start) | (end - pos) | (cap - end) ) < 0L) {
-      throw new IllegalArgumentException(
+      throw new BoundsException(
           "Violation of Invariants: "
               + "start: " + start
               + " <= pos: " + pos
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
index 54bcc25..0826c2e 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
@@ -20,11 +20,13 @@
 package org.apache.datasketches.memory.internal;
 
 import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
+import static org.apache.datasketches.memory.internal.Util.characterPad;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
 import org.apache.datasketches.memory.BaseState;
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.MemoryRequestServer;
 import org.apache.datasketches.memory.ReadOnlyException;
 
@@ -91,14 +93,14 @@ public abstract class BaseStateImpl implements BaseState {
     JDK_MAJOR = (p[0] == 1) ? p[1] : p[0];
   }
 
-  private final long capacityBytes_;
+  private final long capacityBytes_; //NOT USED in JDK 17
 
   /**
    * This becomes the base offset used by all Unsafe calls. It is cumulative in that in includes
    * all offsets from regions, user-defined offsets when creating MemoryImpl, and the array object
    * header offset when creating MemoryImpl from primitive arrays.
    */
-  private final long cumBaseOffset_;
+  private final long cumBaseOffset_; //NOT USED in JDK 17
 
   /**
    * Constructor
@@ -121,21 +123,6 @@ public abstract class BaseStateImpl implements BaseState {
 
   //**STATIC METHODS*****************************************
 
-  /**
-   * Assert the requested offset and length against the allocated size.
-   * The invariants equation is: {@code 0 <= reqOff <= reqLen <= reqOff + reqLen <= allocSize}.
-   * If this equation is violated and assertions are enabled, an {@link AssertionError} will
-   * be thrown.
-   * @param reqOff the requested offset
-   * @param reqLen the requested length
-   * @param allocSize the allocated size.
-   */
-  public static void assertBounds(final long reqOff, final long reqLen, final long allocSize) {
-    assert ((reqOff | reqLen | (reqOff + reqLen) | (allocSize - (reqOff + reqLen))) >= 0) :
-      "reqOffset: " + reqOff + ", reqLength: " + reqLen
-      + ", (reqOff + reqLen): " + (reqOff + reqLen) + ", allocSize: " + allocSize;
-  }
-
   /**
    * Check the requested offset and length against the allocated size.
    * The invariants equation is: {@code 0 <= reqOff <= reqLen <= reqOff + reqLen <= allocSize}.
@@ -146,7 +133,7 @@ public abstract class BaseStateImpl implements BaseState {
    */
   public static void checkBounds(final long reqOff, final long reqLen, final long allocSize) {
     if ((reqOff | reqLen | (reqOff + reqLen) | (allocSize - (reqOff + reqLen))) < 0) {
-      throw new IllegalArgumentException(
+      throw new BoundsException(
           "reqOffset: " + reqOff + ", reqLength: " + reqLen
               + ", (reqOff + reqLen): " + (reqOff + reqLen) + ", allocSize: " + allocSize);
     }
@@ -171,6 +158,10 @@ public abstract class BaseStateImpl implements BaseState {
     return NATIVE_BYTE_ORDER == byteOrder;
   }
 
+  static String pad(final String s, final int fieldLen) {
+    return characterPad(s, fieldLen, ' ' , true);
+  }
+
   /**
    * Returns first two number groups of the java version string.
    * @param jdkVer the java version string from System.getProperty("java.version").
@@ -263,44 +254,44 @@ public abstract class BaseStateImpl implements BaseState {
    * @param typeId the given typeId
    * @return a human readable string.
    */
-  public static final String typeDecode(final int typeId) {
+  static final String typeDecode(final int typeId) {
     final StringBuilder sb = new StringBuilder();
     final int group1 = typeId & 0x7;
     switch (group1) { // 0000 0XXX
-      case 0 : sb.append("Writable:\t"); break;
-      case 1 : sb.append("ReadOnly:\t"); break;
-      case 2 : sb.append("Writable:\tRegion:\t"); break;
-      case 3 : sb.append("ReadOnly:\tRegion:\t"); break;
-      case 4 : sb.append("Writable:\tDuplicate:\t"); break;
-      case 5 : sb.append("ReadOnly:\tDuplicate:\t"); break;
-      case 6 : sb.append("Writable:\tRegion:\tDuplicate:\t"); break;
-      case 7 : sb.append("ReadOnly:\tRegion:\tDuplicate:\t"); break;
+      case 0 : sb.append(pad("Writable + ",32)); break;
+      case 1 : sb.append(pad("ReadOnly + ",32)); break;
+      case 2 : sb.append(pad("Writable + Region + ",32)); break;
+      case 3 : sb.append(pad("ReadOnly + Region + ",32)); break;
+      case 4 : sb.append(pad("Writable + Duplicate + ",32)); break;
+      case 5 : sb.append(pad("ReadOnly + Duplicate + ",32)); break;
+      case 6 : sb.append(pad("Writable + Region + Duplicate + ",32)); break;
+      case 7 : sb.append(pad("ReadOnly + Region + Duplicate + ",32)); break;
       default: break;
     }
     final int group2 = (typeId >>> 3) & 0x3;
     switch (group2) { // 000X X000
-      case 0 : sb.append("Heap:\t"); break;
-      case 1 : sb.append("Direct:\t"); break;
-      case 2 : sb.append("Map:\t"); break;
-      case 3 : sb.append("Direct:\tMap:\t"); break;
+      case 0 : sb.append(pad("Heap + ",15)); break;
+      case 1 : sb.append(pad("Direct + ",15)); break;
+      case 2 : sb.append(pad("Map + Direct + ",15)); break;
+      case 3 : sb.append(pad("Map + Direct + ",15)); break;
       default: break;
     }
     final int group3 = (typeId >>> 5) & 0x1;
     switch (group3) { // 00X0 0000
-      case 0 : sb.append("NativeOrder:\t"); break;
-      case 1 : sb.append("NonNativeOrder:\t"); break;
+      case 0 : sb.append(pad("NativeOrder + ",17)); break;
+      case 1 : sb.append(pad("NonNativeOrder + ",17)); break;
       default: break;
     }
     final int group4 = (typeId >>> 6) & 0x1;
     switch (group4) { // 0X00 0000
-      case 0 : sb.append("Memory:\t"); break;
-      case 1 : sb.append("Buffer:\t"); break;
+      case 0 : sb.append(pad("Memory + ",9)); break;
+      case 1 : sb.append(pad("Buffer + ",9)); break;
       default: break;
     }
     final int group5 = (typeId >>> 7) & 0x1;
     switch (group5) { // X000 0000
-      case 0 : sb.append(""); break;
-      case 1 : sb.append("ByteBuffer"); break;
+      case 0 : sb.append(pad("",10)); break;
+      case 1 : sb.append(pad("ByteBuffer",10)); break;
       default: break;
     }
     return sb.toString();
@@ -308,30 +299,9 @@ public abstract class BaseStateImpl implements BaseState {
 
   //**NON STATIC METHODS*****************************************
 
-  final void assertValid() {
-    assert isValid() : "MemoryImpl not valid.";
-  }
-
-  final void assertValidAndBoundsForRead(final long offsetBytes, final long lengthBytes) {
-    assertValid();
-    // capacityBytes_ is intentionally read directly instead of calling getCapacity()
-    // because the later can make JVM to not inline the assert code path (and entirely remove it)
-    // even though it does nothing in production code path.
-    assertBounds(offsetBytes, lengthBytes, capacityBytes_);
-  }
-
-  final void assertValidAndBoundsForWrite(final long offsetBytes, final long lengthBytes) {
-    assertValid();
-    // capacityBytes_ is intentionally read directly instead of calling getCapacity()
-    // because the later can make JVM to not inline the assert code path (and entirely remove it)
-    // even though it does nothing in production code path.
-    assertBounds(offsetBytes, lengthBytes, capacityBytes_);
-    assert !isReadOnly() : "MemoryImpl is read-only.";
-  }
-
   void checkValid() {
     if (!isValid()) {
-      throw new IllegalStateException("MemoryImpl not valid.");
+      throw new IllegalStateException("Memory not valid.");
     }
   }
 
@@ -342,12 +312,12 @@ public abstract class BaseStateImpl implements BaseState {
     checkBounds(offsetBytes, lengthBytes, capacityBytes_);
   }
 
-  final void checkValidAndBoundsForWrite(final long offsetBytes, final long lengthBytes) {
+  final void checkValidBoundsWritable(final long offsetBytes, final long lengthBytes) {
     checkValid();
     //read capacityBytes_ directly to eliminate extra checkValid() call
     checkBounds(offsetBytes, lengthBytes, capacityBytes_);
     if (isReadOnly()) {
-      throw new ReadOnlyException("MemoryImpl is read-only.");
+      throw new ReadOnlyException("Memory is read-only.");
     }
   }
 
@@ -371,19 +341,19 @@ public abstract class BaseStateImpl implements BaseState {
 
   @Override
   public final long getCapacity() {
-    assertValid();
+    checkValid();
     return capacityBytes_;
   }
 
   @Override
   public final long getCumulativeOffset() {
-    assertValid();
+    checkValid();
     return cumBaseOffset_;
   }
 
   @Override
   public final long getCumulativeOffset(final long offsetBytes) {
-    assertValid();
+    checkValid();
     return cumBaseOffset_ + offsetBytes;
   }
 
@@ -420,14 +390,14 @@ public abstract class BaseStateImpl implements BaseState {
 
   @Override
   public final boolean hasArray() {
-    assertValid();
+    checkValid();
     return getUnsafeObject() != null;
   }
 
   @Override
   public final boolean hasByteBuffer() {
-    assertValid();
-    return (getTypeId() & BYTEBUF) > 0;
+    checkValid();
+    return isByteBufferType();
   }
 
   @Override
@@ -435,7 +405,7 @@ public abstract class BaseStateImpl implements BaseState {
     return (int) xxHash64(0, capacityBytes_, 0); //xxHash64() calls checkValid()
   }
 
-  final boolean isBBType() {
+  final boolean isByteBufferType() {
     return (getTypeId() & BYTEBUF) > 0;
   }
 
@@ -480,7 +450,7 @@ public abstract class BaseStateImpl implements BaseState {
 
   @Override
   public final boolean isReadOnly() {
-    assertValid();
+    checkValid();
     return isReadOnlyType();
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
index ea8daef..cd6ce2c 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
@@ -40,19 +40,6 @@ import org.apache.datasketches.memory.ReadOnlyException;
 import org.apache.datasketches.memory.WritableBuffer;
 import org.apache.datasketches.memory.WritableMemory;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (check*() and incrementAndCheck*() methods), which execute at
- * runtime and throw exceptions if violated. The cost of the runtime checks are minor compared to
- * the rest of the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assert*() and
- * incrementAndAssert*() methods), which only execute when asserts are enabled and JIT will remove
- * them entirely from production runtime code. The offset versions of the light weight methods will
- * simplify to a single unsafe call, which is further simplified by JIT to an intrinsic that is
- * often a single CPU instruction.
- */
-
 /**
  * Common base of native-ordered and non-native-ordered {@link WritableBuffer} implementations.
  * Contains methods which are agnostic to the byte order.
@@ -60,7 +47,7 @@ import org.apache.datasketches.memory.WritableMemory;
 @SuppressWarnings("restriction")
 public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements WritableBuffer {
 
-  //Pass-through ctor
+  //Pass-through constructor
   BaseWritableBufferImpl(final Object unsafeObj, final long nativeBaseOffset,
       final long regionOffset, final long capacityBytes) {
     super(unsafeObj, nativeBaseOffset, regionOffset, capacityBytes);
@@ -84,7 +71,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
             abb.regionOffset, abb.capacityBytes, typeId, byteBuf, memReqSvr)
         : new BBNonNativeWritableBufferImpl(abb.unsafeObj, abb.nativeBaseOffset,
             abb.regionOffset, abb.capacityBytes,  typeId, byteBuf, memReqSvr);
-    bwbi.setStartPositionEnd(0, byteBuf.position(), byteBuf.limit());
+    bwbi.setAndCheckStartPositionEnd(0, byteBuf.position(), byteBuf.limit());
     return bwbi;
   }
 
@@ -121,7 +108,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
     checkValidAndBounds(offsetBytes, capacityBytes);
     final boolean readOnly = isReadOnly() || localReadOnly;
     final WritableBuffer wbuf = toWritableRegion(offsetBytes, capacityBytes, readOnly, byteOrder);
-    wbuf.setStartPositionEnd(0, 0, capacityBytes);
+    wbuf.setAndCheckStartPositionEnd(0, 0, capacityBytes);
     return wbuf;
   }
 
@@ -155,7 +142,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
     }
     final boolean readOnly = isReadOnly() || localReadOnly;
     final WritableBuffer wbuf = toDuplicate(readOnly, byteOrder);
-    wbuf.setStartPositionEnd(getStart(), getPosition(), getEnd());
+    wbuf.setAndCheckStartPositionEnd(getStart(), getPosition(), getEnd());
     return wbuf;
   }
 
@@ -189,13 +176,13 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   @Override
   public final boolean getBoolean() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_BOOLEAN_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_BOOLEAN_INDEX_SCALE);
     return unsafe.getBoolean(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   @Override
   public final boolean getBoolean(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
     return unsafe.getBoolean(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -204,7 +191,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
       final int lengthBooleans) {
     final long pos = getPosition();
     final long copyBytes = lengthBooleans;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetBooleans, lengthBooleans, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -217,13 +204,13 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   @Override
   public final byte getByte() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_BYTE_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_BYTE_INDEX_SCALE);
     return unsafe.getByte(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   @Override
   public final byte getByte(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     return unsafe.getByte(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -232,7 +219,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
       final int lengthBytes) {
     final long pos = getPosition();
     final long copyBytes = lengthBytes;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetBytes, lengthBytes, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -245,45 +232,45 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   //PRIMITIVE getX() Native Endian (used by both endians)
   final char getNativeOrderedChar() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_CHAR_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_CHAR_INDEX_SCALE);
     return unsafe.getChar(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   final char getNativeOrderedChar(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
     return unsafe.getChar(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final int getNativeOrderedInt() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_INT_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_INT_INDEX_SCALE);
     return unsafe.getInt(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   final int getNativeOrderedInt(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_INT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_INT_INDEX_SCALE);
     return unsafe.getInt(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final long getNativeOrderedLong() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_LONG_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_LONG_INDEX_SCALE);
     return unsafe.getLong(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   final long getNativeOrderedLong(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     return unsafe.getLong(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final short getNativeOrderedShort() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_SHORT_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_SHORT_INDEX_SCALE);
     return unsafe.getShort(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   final short getNativeOrderedShort(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
     return unsafe.getShort(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -304,13 +291,13 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   @Override
   public final void putBoolean(final boolean value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_BOOLEAN_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_BOOLEAN_INDEX_SCALE);
     unsafe.putBoolean(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   @Override
   public final void putBoolean(final long offsetBytes, final boolean value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
     unsafe.putBoolean(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -332,13 +319,13 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   @Override
   public final void putByte(final byte value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_BYTE_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_BYTE_INDEX_SCALE);
     unsafe.putByte(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   @Override
   public final void putByte(final long offsetBytes, final byte value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     unsafe.putByte(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -360,52 +347,52 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
   //PRIMITIVE putX() Native Endian (used by both endians)
   final void putNativeOrderedChar(final char value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_CHAR_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_CHAR_INDEX_SCALE);
     unsafe.putChar(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   final void putNativeOrderedChar(final long offsetBytes, final char value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
     unsafe.putChar(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedInt(final int value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_INT_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_INT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   final void putNativeOrderedInt(final long offsetBytes, final int value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_INT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_INT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedLong(final long value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_LONG_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_LONG_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   final void putNativeOrderedLong(final long offsetBytes, final long value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedShort(final short value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_SHORT_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_SHORT_INDEX_SCALE);
     unsafe.putShort(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   final void putNativeOrderedShort(final long offsetBytes, final short value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
     unsafe.putShort(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   //OTHER
   @Override
   public final Object getArray() {
-    assertValid();
+    checkValid();
     return getUnsafeObject();
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
index 818ab53..789be9a 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
@@ -47,18 +47,6 @@ import org.apache.datasketches.memory.WritableHandle;
 import org.apache.datasketches.memory.WritableMapHandle;
 import org.apache.datasketches.memory.WritableMemory;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (checkValid*() and checkBounds()), which execute at runtime and
- * throw exceptions if violated. The cost of the runtime checks are minor compared to the rest of
- * the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assertValid*()), which only
- * execute when asserts are enabled and JIT will remove them entirely from production runtime code.
- * The light weight methods will simplify to a single unsafe call, which is further simplified by
- * JIT to an intrinsic that is often a single CPU instruction.
- */
-
 /**
  * Common base of native-ordered and non-native-ordered {@link WritableMemory} implementations.
  * Contains methods which are agnostic to the byte order.
@@ -73,7 +61,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
     EMPTY_BYTES = new byte[1024];
   }
 
-  //Pass-through ctor
+  //Pass-through constructor
   BaseWritableMemoryImpl(final Object unsafeObj, final long nativeBaseOffset,
       final long regionOffset, final long capacityBytes) {
     super(unsafeObj, nativeBaseOffset, regionOffset, capacityBytes);
@@ -206,7 +194,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
     }
     final boolean readOnly = isReadOnly() || localReadOnly;
     final WritableBuffer wbuf = toWritableBuffer(readOnly, byteOrder);
-    wbuf.setStartPositionEnd(0, 0, getCapacity());
+    wbuf.setAndCheckStartPositionEnd(0, 0, getCapacity());
     return wbuf;
   }
 
@@ -215,7 +203,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
   //PRIMITIVE getX() and getXArray()
   @Override
   public final boolean getBoolean(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
     return unsafe.getBoolean(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -235,7 +223,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   @Override
   public final byte getByte(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     return unsafe.getByte(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -275,22 +263,22 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   //PRIMITIVE getX() Native Endian (used by both endians)
   final char getNativeOrderedChar(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
     return unsafe.getChar(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final int getNativeOrderedInt(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_INT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_INT_INDEX_SCALE);
     return unsafe.getInt(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final long getNativeOrderedLong(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     return unsafe.getLong(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   final short getNativeOrderedShort(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
     return unsafe.getShort(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -327,7 +315,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
   //PRIMITIVE putX() and putXArray() implementations
   @Override
   public final void putBoolean(final long offsetBytes, final boolean value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BOOLEAN_INDEX_SCALE);
     unsafe.putBoolean(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -335,7 +323,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
   public final void putBooleanArray(final long offsetBytes, final boolean[] srcArray,
       final int srcOffsetBooleans, final int lengthBooleans) {
     final long copyBytes = lengthBooleans;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetBooleans, lengthBooleans, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -348,7 +336,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   @Override
   public final void putByte(final long offsetBytes, final byte value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     unsafe.putByte(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -356,7 +344,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
   public final void putByteArray(final long offsetBytes, final byte[] srcArray,
       final int srcOffsetBytes, final int lengthBytes) {
     final long copyBytes = lengthBytes;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetBytes, lengthBytes, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -376,29 +364,29 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   //PRIMITIVE putX() Native Endian (used by both endians)
   final void putNativeOrderedChar(final long offsetBytes, final char value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_CHAR_INDEX_SCALE);
     unsafe.putChar(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedInt(final long offsetBytes, final int value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_INT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_INT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedLong(final long offsetBytes, final long value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   final void putNativeOrderedShort(final long offsetBytes, final short value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_SHORT_INDEX_SCALE);
     unsafe.putShort(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
   //OTHER WRITE METHODS
   @Override
   public final Object getArray() {
-    assertValid();
+    checkValid();
     return getUnsafeObject();
   }
 
@@ -420,7 +408,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   @Override
   public final void clearBits(final long offsetBytes, final byte bitMask) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     final long cumBaseOff = getCumulativeOffset(offsetBytes);
     int value = unsafe.getByte(getUnsafeObject(), cumBaseOff) & 0XFF;
     value &= ~bitMask;
@@ -434,7 +422,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   @Override
   public final void fill(long offsetBytes, long lengthBytes, final byte value) {
-    checkValidAndBoundsForWrite(offsetBytes, lengthBytes);
+    checkValidBoundsWritable(offsetBytes, lengthBytes);
     while (lengthBytes > 0) {
       final long chunk = Math.min(lengthBytes, Util.UNSAFE_COPY_THRESHOLD_BYTES);
       unsafe.setMemory(getUnsafeObject(), getCumulativeOffset(offsetBytes), chunk, value);
@@ -445,7 +433,7 @@ public abstract class BaseWritableMemoryImpl extends BaseStateImpl implements Wr
 
   @Override
   public final void setBits(final long offsetBytes, final byte bitMask) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_BYTE_INDEX_SCALE);
     final long myOffset = getCumulativeOffset(offsetBytes);
     final byte value = unsafe.getByte(getUnsafeObject(), myOffset);
     unsafe.putByte(getUnsafeObject(), myOffset, (byte)(value | bitMask));
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java
index 3b0a183..1e595ca 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java
@@ -84,7 +84,7 @@ final class DirectNonNativeWritableBufferImpl extends NonNativeWritableBufferImp
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java
index 7be7e74..616c13d 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java
@@ -74,7 +74,7 @@ final class DirectNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImp
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java
index 84e7d5e..768bf4d 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java
@@ -84,7 +84,7 @@ final class DirectWritableBufferImpl extends NativeWritableBufferImpl {
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
index 68a3461..4f5c951 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
@@ -74,7 +74,7 @@ final class DirectWritableMemoryImpl extends NativeWritableMemoryImpl {
 
   @Override
   public MemoryRequestServer getMemoryRequestServer() {
-    assertValid();
+    checkValid();
     return memReqSvr;
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
index 64b5841..b8f92ec 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java
@@ -31,19 +31,6 @@ import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
 
 import org.apache.datasketches.memory.WritableBuffer;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (check*() and incrementAndCheck*() methods), which execute at
- * runtime and throw exceptions if violated. The cost of the runtime checks are minor compared to
- * the rest of the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assert*() and
- * incrementAndAssert*() methods), which only execute when asserts are enabled and JIT will remove
- * them entirely from production runtime code. The offset versions of the light weight methods will
- * simplify to a single unsafe call, which is further simplified by JIT to an intrinsic that is
- * often a single CPU instruction.
- */
-
 /**
  * Implementation of {@link WritableBuffer} for native endian byte order.
  * @author Roman Leventov
@@ -52,7 +39,7 @@ import org.apache.datasketches.memory.WritableBuffer;
 @SuppressWarnings("restriction")
 abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
 
-  //Pass-through ctor
+  //Pass-through constructor
   NativeWritableBufferImpl(final Object unsafeObj, final long nativeBaseOffset, final long regionOffset,
       final long capacityBytes) {
     super(unsafeObj, nativeBaseOffset, regionOffset, capacityBytes);
@@ -73,7 +60,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getCharArray(final char[] dstArray, final int dstOffsetChars, final int lengthChars) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthChars) << CHAR_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetChars, lengthChars, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -86,13 +73,13 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public double getDouble() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_DOUBLE_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_DOUBLE_INDEX_SCALE);
     return unsafe.getDouble(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   @Override
   public double getDouble(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     return unsafe.getDouble(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -101,7 +88,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthDoubles) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthDoubles) << DOUBLE_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetDoubles, lengthDoubles, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -114,13 +101,13 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public float getFloat() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_FLOAT_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_FLOAT_INDEX_SCALE);
     return unsafe.getFloat(getUnsafeObject(), getCumulativeOffset(pos));
   }
 
   @Override
   public float getFloat(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     return unsafe.getFloat(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -129,7 +116,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthFloats) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthFloats) << FLOAT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetFloats, lengthFloats, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -153,7 +140,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getIntArray(final int[] dstArray, final int dstOffsetInts, final int lengthInts) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthInts) << INT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetInts, lengthInts, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -177,7 +164,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getLongArray(final long[] dstArray, final int dstOffsetLongs, final int lengthLongs) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthLongs) << LONG_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetLongs, lengthLongs, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -202,7 +189,7 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthShorts) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthShorts) << SHORT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     checkBounds(dstOffsetShorts, lengthShorts, dstArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
             getUnsafeObject(),
@@ -240,13 +227,13 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public void putDouble(final double value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_DOUBLE_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putDouble(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   @Override
   public void putDouble(final long offsetBytes, final double value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putDouble(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -268,13 +255,13 @@ abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public void putFloat(final float value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_FLOAT_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putFloat(getUnsafeObject(), getCumulativeOffset(pos), value);
   }
 
   @Override
   public void putFloat(final long offsetBytes, final float value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putFloat(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
index 4603158..52ef867 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java
@@ -32,18 +32,6 @@ import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
 
 import org.apache.datasketches.memory.WritableMemory;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (checkValid*() and checkBounds()), which execute at runtime and
- * throw exceptions if violated. The cost of the runtime checks are minor compared to the rest of
- * the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assertValid*()), which only
- * execute when asserts are enabled and JIT will remove them entirely from production runtime code.
- * The light weight methods will simplify to a single unsafe call, which is further simplified by
- * JIT to an intrinsic that is often a single CPU instruction.
- */
-
 /**
  * Implementation of {@link WritableMemory} for native endian byte order.
  * @author Roman Leventov
@@ -52,7 +40,7 @@ import org.apache.datasketches.memory.WritableMemory;
 @SuppressWarnings("restriction")
 abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
-  //Pass-through ctor
+  //Pass-through constructor
   NativeWritableMemoryImpl(final Object unsafeObj, final long nativeBaseOffset,
       final long regionOffset, final long capacityBytes) {
     super(unsafeObj, nativeBaseOffset, regionOffset, capacityBytes);
@@ -80,7 +68,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public double getDouble(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     return unsafe.getDouble(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -100,7 +88,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public float getFloat(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     return unsafe.getFloat(getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
@@ -185,7 +173,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putCharArray(final long offsetBytes, final char[] srcArray,
       final int srcOffsetChars, final int lengthChars) {
     final long copyBytes = ((long) lengthChars) << CHAR_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetChars, lengthChars, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -198,7 +186,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public void putDouble(final long offsetBytes, final double value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putDouble(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -206,7 +194,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putDoubleArray(final long offsetBytes, final double[] srcArray,
       final int srcOffsetDoubles, final int lengthDoubles) {
     final long copyBytes = ((long) lengthDoubles) << DOUBLE_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetDoubles, lengthDoubles, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -219,7 +207,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public void putFloat(final long offsetBytes, final float value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putFloat(getUnsafeObject(), getCumulativeOffset(offsetBytes), value);
   }
 
@@ -227,7 +215,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putFloatArray(final long offsetBytes, final float[] srcArray,
       final int srcOffsetFloats, final int lengthFloats) {
     final long copyBytes = ((long) lengthFloats) << FLOAT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetFloats, lengthFloats, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -247,7 +235,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putIntArray(final long offsetBytes, final int[] srcArray, final int srcOffsetInts,
       final int lengthInts) {
     final long copyBytes = ((long) lengthInts) << INT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetInts, lengthInts, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -267,7 +255,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putLongArray(final long offsetBytes, final long[] srcArray, final int srcOffsetLongs,
       final int lengthLongs) {
     final long copyBytes = ((long) lengthLongs) << LONG_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetLongs, lengthLongs, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -287,7 +275,7 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putShortArray(final long offsetBytes, final short[] srcArray,
       final int srcOffsetShorts, final int lengthShorts) {
     final long copyBytes = ((long) lengthShorts) << SHORT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     checkBounds(srcOffsetShorts, lengthShorts, srcArray.length);
     CompareAndCopy.copyMemoryCheckingDifferentObject(
         srcArray,
@@ -301,21 +289,21 @@ abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   //Atomic Write Methods
   @Override
   public long getAndAddLong(final long offsetBytes, final long delta) { //JDK 8+
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     final long addr = getCumulativeOffset(offsetBytes);
     return unsafe.getAndAddLong(getUnsafeObject(), addr, delta);
   }
 
   @Override
   public long getAndSetLong(final long offsetBytes, final long newValue) { //JDK 8+
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     final long addr = getCumulativeOffset(offsetBytes);
     return unsafe.getAndSetLong(getUnsafeObject(), addr, newValue);
   }
 
   @Override
   public boolean compareAndSwapLong(final long offsetBytes, final long expect, final long update) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     return unsafe.compareAndSwapLong(
         getUnsafeObject(), getCumulativeOffset(offsetBytes), expect, update);
   }
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
index 5fd033d..ce18109 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java
@@ -25,19 +25,6 @@ import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
 
 import org.apache.datasketches.memory.WritableBuffer;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (check*() and incrementAndCheck*() methods), which execute at
- * runtime and throw exceptions if violated. The cost of the runtime checks are minor compared to
- * the rest of the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assert*() and
- * incrementAndAssert*() methods), which only execute when asserts are enabled and JIT will remove
- * them entirely from production runtime code. The offset versions of the light weight methods will
- * simplify to a single unsafe call, which is further simplified by JIT to an intrinsic that is
- * often a single CPU instruction.
- */
-
 /**
  * Implementation of {@link WritableBuffer} for non-native endian byte order.
  * @author Roman Leventov
@@ -67,7 +54,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getCharArray(final char[] dstArray, final int dstOffsetChars, final int lengthChars) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthChars) << CHAR_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeChars(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetChars, lengthChars);
   }
@@ -75,14 +62,14 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public double getDouble() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_DOUBLE_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_DOUBLE_INDEX_SCALE);
     return Double.longBitsToDouble(
         Long.reverseBytes(unsafe.getLong(getUnsafeObject(), getCumulativeOffset(pos))));
   }
 
   @Override
   public double getDouble(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     return Double.longBitsToDouble(
         Long.reverseBytes(unsafe.getLong(getUnsafeObject(), getCumulativeOffset(offsetBytes))));
   }
@@ -92,7 +79,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthDoubles) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthDoubles) << DOUBLE_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeDoubles(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetDoubles, lengthDoubles);
   }
@@ -100,14 +87,14 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public float getFloat() {
     final long pos = getPosition();
-    incrementAndAssertPositionForRead(pos, ARRAY_FLOAT_INDEX_SCALE);
+    incrementAndCheckPosition(pos, ARRAY_FLOAT_INDEX_SCALE);
     return Float.intBitsToFloat(
         Integer.reverseBytes(unsafe.getInt(getUnsafeObject(), getCumulativeOffset(pos))));
   }
 
   @Override
   public float getFloat(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     return Float.intBitsToFloat(
         Integer.reverseBytes(unsafe.getInt(getUnsafeObject(), getCumulativeOffset(offsetBytes))));
   }
@@ -117,7 +104,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthFloats) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthFloats) << FLOAT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeFloats(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetFloats, lengthFloats);
   }
@@ -136,7 +123,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getIntArray(final int[] dstArray, final int dstOffsetInts, final int lengthInts) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthInts) << INT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeInts(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetInts, lengthInts);
   }
@@ -155,7 +142,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   public void getLongArray(final long[] dstArray, final int dstOffsetLongs, final int lengthLongs) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthLongs) << LONG_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeLongs(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetLongs, lengthLongs);
   }
@@ -175,7 +162,7 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
       final int lengthShorts) {
     final long pos = getPosition();
     final long copyBytes = ((long) lengthShorts) << SHORT_SHIFT;
-    incrementAndCheckPositionForRead(pos, copyBytes);
+    incrementAndCheckPosition(pos, copyBytes);
     CompareAndCopy.getNonNativeShorts(getUnsafeObject(), getCumulativeOffset(pos), copyBytes,
         dstArray, dstOffsetShorts, lengthShorts);
   }
@@ -203,14 +190,14 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public void putDouble(final double value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_DOUBLE_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(pos),
         Long.reverseBytes(Double.doubleToRawLongBits(value)));
   }
 
   @Override
   public void putDouble(final long offsetBytes, final double value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(offsetBytes),
         Long.reverseBytes(Double.doubleToRawLongBits(value)));
   }
@@ -228,14 +215,14 @@ abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl {
   @Override
   public void putFloat(final float value) {
     final long pos = getPosition();
-    incrementAndAssertPositionForWrite(pos, ARRAY_FLOAT_INDEX_SCALE);
+    incrementAndCheckPositionForWrite(pos, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(pos),
         Integer.reverseBytes(Float.floatToRawIntBits(value)));
   }
 
   @Override
   public void putFloat(final long offsetBytes, final float value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(offsetBytes),
         Integer.reverseBytes(Float.floatToRawIntBits(value)));
   }
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
index bbf2dc3..894dd79 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java
@@ -26,18 +26,6 @@ import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
 
 import org.apache.datasketches.memory.WritableMemory;
 
-/*
- * Developer notes: The heavier methods, such as put/get arrays, duplicate, region, clear, fill,
- * compareTo, etc., use hard checks (checkValid*() and checkBounds()), which execute at runtime and
- * throw exceptions if violated. The cost of the runtime checks are minor compared to the rest of
- * the work these methods are doing.
- *
- * <p>The light weight methods, such as put/get primitives, use asserts (assertValid*()), which only
- * execute when asserts are enabled and JIT will remove them entirely from production runtime code.
- * The light weight methods will simplify to a single unsafe call, which is further simplified by
- * JIT to an intrinsic that is often a single CPU instruction.
- */
-
 /**
  * Implementation of {@link WritableMemory} for non-native endian byte order.
  * @author Roman Leventov
@@ -69,7 +57,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public double getDouble(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     return Double.longBitsToDouble(
         Long.reverseBytes(unsafe.getLong(getUnsafeObject(), getCumulativeOffset(offsetBytes))));
   }
@@ -85,7 +73,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public float getFloat(final long offsetBytes) {
-    assertValidAndBoundsForRead(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidAndBounds(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     return Float.intBitsToFloat(
         Integer.reverseBytes(unsafe.getInt(getUnsafeObject(), getCumulativeOffset(offsetBytes))));
   }
@@ -151,14 +139,14 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putCharArray(final long offsetBytes, final char[] srcArray, final int srcOffsetChars,
       final int lengthChars) {
     final long copyBytes = ((long) lengthChars) << CHAR_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeChars(srcArray, srcOffsetChars, lengthChars, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   @Override
   public void putDouble(final long offsetBytes, final double value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_DOUBLE_INDEX_SCALE);
     unsafe.putLong(getUnsafeObject(), getCumulativeOffset(offsetBytes),
         Long.reverseBytes(Double.doubleToRawLongBits(value)));
   }
@@ -167,14 +155,14 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putDoubleArray(final long offsetBytes, final double[] srcArray,
       final int srcOffsetDoubles, final int lengthDoubles) {
     final long copyBytes = ((long) lengthDoubles) << DOUBLE_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeDoubles(srcArray, srcOffsetDoubles, lengthDoubles, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
 
   @Override
   public void putFloat(final long offsetBytes, final float value) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_FLOAT_INDEX_SCALE);
     unsafe.putInt(getUnsafeObject(), getCumulativeOffset(offsetBytes),
         Integer.reverseBytes(Float.floatToRawIntBits(value)));
   }
@@ -183,7 +171,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putFloatArray(final long offsetBytes, final float[] srcArray,
       final int srcOffsetFloats, final int lengthFloats) {
     final long copyBytes = ((long) lengthFloats) << FLOAT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeFloats(srcArray, srcOffsetFloats, lengthFloats, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
@@ -197,7 +185,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putIntArray(final long offsetBytes, final int[] srcArray, final int srcOffsetInts,
       final int lengthInts) {
     final long copyBytes = ((long) lengthInts) << INT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeInts(srcArray, srcOffsetInts, lengthInts, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
@@ -211,7 +199,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putLongArray(final long offsetBytes, final long[] srcArray, final int srcOffsetLongs,
       final int lengthLongs) {
     final long copyBytes = ((long) lengthLongs) << LONG_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeLongs(srcArray, srcOffsetLongs, lengthLongs, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
@@ -225,7 +213,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   public void putShortArray(final long offsetBytes, final short[] srcArray,
       final int srcOffsetShorts, final int lengthShorts) {
     final long copyBytes = ((long) lengthShorts) << SHORT_SHIFT;
-    checkValidAndBoundsForWrite(offsetBytes, copyBytes);
+    checkValidBoundsWritable(offsetBytes, copyBytes);
     CompareAndCopy.putNonNativeShorts(srcArray, srcOffsetShorts, lengthShorts, copyBytes,
         getUnsafeObject(), getCumulativeOffset(offsetBytes));
   }
@@ -233,7 +221,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
   //Atomic Write Methods
   @Override
   public long getAndAddLong(final long offsetBytes, final long delta) { //JDK 8+
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     final long addr = getCumulativeOffset(offsetBytes);
     long oldValReverseBytes, oldVal, newValReverseBytes;
     final Object unsafeObj = getUnsafeObject();
@@ -248,7 +236,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public long getAndSetLong(final long offsetBytes, final long newValue) { //JDK 8+
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     final long addr = getCumulativeOffset(offsetBytes);
     final long newValueReverseBytes = Long.reverseBytes(newValue);
     return Long.reverseBytes(unsafe.getAndSetLong(getUnsafeObject(), addr, newValueReverseBytes));
@@ -256,7 +244,7 @@ abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl {
 
   @Override
   public boolean compareAndSwapLong(final long offsetBytes, final long expect, final long update) {
-    assertValidAndBoundsForWrite(offsetBytes, ARRAY_LONG_INDEX_SCALE);
+    checkValidBoundsWritable(offsetBytes, ARRAY_LONG_INDEX_SCALE);
     return unsafe.compareAndSwapLong(getUnsafeObject(), getCumulativeOffset(offsetBytes),
         Long.reverseBytes(expect), Long.reverseBytes(update));
   }
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java
index 4dd76ca..b7ecaf6 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java
@@ -165,8 +165,7 @@
  *     Memory reg = wMem.region(offset, length);
  * </pre></blockquote>
  *
- * <p>With asserts enabled in the JVM, all methods are checked for bounds and
- * use-after-close violations.</p>
+ * <p>All methods are checked for bounds and use-after-close violations.</p>
  *
  * @author Lee Rhodes
  */
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
index c3185cc..ea47eae 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
@@ -74,7 +74,7 @@ public class AllocateDirectMapMemoryTest {
   }
 
   @Test
-  public void testMapAndMultipleClose() throws Exception {
+  public void testMapAndMultipleClose() throws IllegalStateException {
     File file = getResourceFile("GettysburgAddress.txt");
     long memCapacity = file.length();
     try (MapHandle rh = Memory.map(file, 0, memCapacity, NATIVE_BYTE_ORDER)) {
@@ -82,21 +82,21 @@ public class AllocateDirectMapMemoryTest {
       assertEquals(memCapacity, map.getCapacity());
       rh.close();
       rh.close();
-      map.getCapacity(); //throws assertion error
-    } catch (AssertionError e) {
+      map.getCapacity();
+    } catch (Exception e) {
       //OK
     }
   }
 
   @Test
-  public void testReadFailAfterClose() throws Exception {
+  public void testReadFailAfterClose() throws IllegalStateException {
     File file = getResourceFile("GettysburgAddress.txt");
     long memCapacity = file.length();
     try (MapHandle rh = Memory.map(file, 0, memCapacity, NATIVE_BYTE_ORDER)) {
       Memory mmf = rh.get();
       rh.close();
       mmf.getByte(0);
-    } catch (AssertionError e) {
+    } catch (Exception e) {
       //OK
     }
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseBufferTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseBufferTest.java
index 4e8bfff..229f85d 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseBufferTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseBufferTest.java
@@ -21,6 +21,7 @@ package org.apache.datasketches.memory.internal;
 
 import static org.testng.Assert.fail;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Buffer;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableHandle;
@@ -35,12 +36,12 @@ public class BaseBufferTest {
   @Test
   public void checkLimits() {
     Buffer buf = Memory.wrap(new byte[100]).asBuffer();
-    buf.setStartPositionEnd(40, 45, 50);
-    buf.setStartPositionEnd(0, 0, 100);
+    buf.setAndCheckStartPositionEnd(40, 45, 50);
+    buf.setAndCheckStartPositionEnd(0, 0, 100);
     try {
-      buf.setStartPositionEnd(0, 0, 101);
+      buf.setAndCheckStartPositionEnd(0, 0, 101);
       fail();
-    } catch (AssertionError e) {
+    } catch (BoundsException e) {
       //ok
     }
   }
@@ -53,22 +54,22 @@ public class BaseBufferTest {
     try {
       buf.setAndCheckStartPositionEnd(0, 0, 101);
       fail();
-    } catch (IllegalArgumentException e) {
+    } catch (BoundsException e) {
       //ok
     }
     buf.setAndCheckPosition(100);
     try {
       buf.setAndCheckPosition(101);
       fail();
-    } catch (IllegalArgumentException e) {
+    } catch (BoundsException e) {
       //ok
     }
-    buf.setPosition(99);
+    buf.setAndCheckPosition(99);
     buf.incrementAndCheckPosition(1L);
     try {
       buf.incrementAndCheckPosition(1L);
       fail();
-    } catch (IllegalArgumentException e) {
+    } catch (BoundsException e) {
       //ok
     }
   }
@@ -84,6 +85,6 @@ public class BaseBufferTest {
     try {
       @SuppressWarnings("unused")
       Memory mem = buf.asMemory();
-    } catch (AssertionError ae) { }
+    } catch (IllegalStateException e) { }
   }
 }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
index 0c09fc6..a054ef9 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
@@ -175,8 +175,9 @@ public class BaseStateTest {
 
   @Test
   public void checkTypeDecode() {
-    for (int i = 0; i < 128; i++) {
-      typeDecode(i);
+    for (int i = 0; i < 256; i++) {
+      String str = typeDecode(i);
+      println(i + "\t" + str);
     }
   }
 
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
index 7bf9269..e94f384 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
@@ -92,7 +92,7 @@ public class Buffer2Test {
       assertEquals(byteArray[i++], buffer.getByte());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     byte[] copyByteArray = new byte[64];
     buffer.getByteArray(copyByteArray, 0, 64);
     assertEquals(byteArray, copyByteArray);
@@ -115,7 +115,7 @@ public class Buffer2Test {
       assertEquals(charArray[i++], buffer.getChar());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     char[] copyCharArray = new char[64];
     buffer.getCharArray(copyCharArray, 0, 64);
     assertEquals(charArray, copyCharArray);
@@ -135,7 +135,7 @@ public class Buffer2Test {
       assertEquals(shortArray[i++], buffer.getShort());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     short[] copyShortArray = new short[64];
     buffer.getShortArray(copyShortArray, 0, 64);
     assertEquals(shortArray, copyShortArray);
@@ -155,7 +155,7 @@ public class Buffer2Test {
       assertEquals(intArray[i++], buffer.getInt());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     int[] copyIntArray = new int[64];
     buffer.getIntArray(copyIntArray, 0, 64);
     assertEquals(intArray, copyIntArray);
@@ -175,7 +175,7 @@ public class Buffer2Test {
       assertEquals(longArray[i++], buffer.getLong());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     long[] copyLongArray = new long[64];
     buffer.getLongArray(copyLongArray, 0, 64);
     assertEquals(longArray, copyLongArray);
@@ -195,7 +195,7 @@ public class Buffer2Test {
       assertEquals(floatArray[i++], buffer.getFloat());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     float[] copyFloatArray = new float[64];
     buffer.getFloatArray(copyFloatArray, 0, 64);
     assertEquals(floatArray, copyFloatArray);
@@ -215,7 +215,7 @@ public class Buffer2Test {
       assertEquals(doubleArray[i++], buffer.getDouble());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     double[] copyDoubleArray = new double[64];
     buffer.getDoubleArray(copyDoubleArray, 0, 64);
     assertEquals(doubleArray, copyDoubleArray);
@@ -237,7 +237,7 @@ public class Buffer2Test {
       assertEquals(booleanArray[i++], buffer.getBoolean());
     }
 
-    buffer.setPosition(0);
+    buffer.setAndCheckPosition(0);
     boolean[] copyBooleanArray = new boolean[64];
     buffer.getBooleanArray(copyBooleanArray, 0, 64);
     for (int j = 0; j < copyBooleanArray.length; j++) {
@@ -291,8 +291,8 @@ public class Buffer2Test {
 
     Buffer buffer = Buffer.wrap(bb);
     assertEquals(bb.position(), buffer.getPosition());
-    assertEquals(30, buffer.setPosition(30).getPosition());
-    assertEquals(40, buffer.incrementPosition(10).getPosition());
+    assertEquals(30, buffer.setAndCheckPosition(30).getPosition());
+    assertEquals(40, buffer.incrementAndCheckPosition(10).getPosition());
     assertEquals(0, buffer.resetPosition().getPosition());
   }
 
@@ -313,8 +313,8 @@ public class Buffer2Test {
     }
 
     assertEquals(bb.position(), buffer.getPosition() + 10);
-    assertEquals(30, buffer.setPosition(30).getPosition());
-    assertEquals(40, buffer.incrementPosition(10).getPosition());
+    assertEquals(30, buffer.setAndCheckPosition(30).getPosition());
+    assertEquals(40, buffer.incrementAndCheckPosition(10).getPosition());
     assertEquals(0, buffer.resetPosition().getPosition());
   }
 
@@ -330,7 +330,7 @@ public class Buffer2Test {
     bb.position(10);
 
     Buffer buffer = Buffer.wrap(bb.slice().order(NATIVE_BYTE_ORDER)); //slice = 54
-    buffer.setPosition(30);//remaining = 24
+    buffer.setAndCheckPosition(30);//remaining = 24
     Buffer dupBuffer = buffer.duplicate(); //all 54
     Buffer regionBuffer = buffer.region(); //24
 
@@ -381,7 +381,7 @@ public class Buffer2Test {
     }
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testROByteBuffer() {
     byte[] arr = new byte[64];
     ByteBuffer roBB = ByteBuffer.wrap(arr).asReadOnlyBuffer();
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java
index 535b0ca..9fffbf6 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.datasketches.memory.internal;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
 
@@ -31,8 +32,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getBoolean(7);
     try {
       writableMemory.getBoolean(8);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -42,8 +43,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putBoolean(7, true);
     try {
       writableMemory.putBoolean(8, true);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -53,8 +54,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getByte(7);
     try {
       writableMemory.getByte(8);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -64,8 +65,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putByte(7, (byte) 1);
     try {
       writableMemory.putByte(8, (byte) 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -75,8 +76,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getChar(6);
     try {
       writableMemory.getChar(7);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -86,8 +87,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putChar(6, 'a');
     try {
       writableMemory.putChar(7, 'a');
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -97,8 +98,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getShort(6);
     try {
       writableMemory.getShort(7);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -108,8 +109,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putShort(6, (short) 1);
     try {
       writableMemory.putShort(7, (short) 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -119,8 +120,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getInt(4);
     try {
       writableMemory.getInt(5);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -130,8 +131,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putInt(4, 1);
     try {
       writableMemory.putInt(5, 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -141,8 +142,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getFloat(4);
     try {
       writableMemory.getFloat(5);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -152,8 +153,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putFloat(4, 1f);
     try {
       writableMemory.putFloat(5, 1f);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -163,8 +164,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getLong(0);
     try {
       writableMemory.getLong(1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -174,8 +175,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putLong(0, 1L);
     try {
       writableMemory.putLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -185,8 +186,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getDouble(0);
     try {
       writableMemory.getDouble(1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -196,8 +197,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.putDouble(0, 1d);
     try {
       writableMemory.putDouble(1, 1d);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -207,8 +208,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getAndAddLong(0, 1L);
     try {
       writableMemory.getAndAddLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -218,8 +219,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.getAndSetLong(0, 1L);
     try {
       writableMemory.getAndSetLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -229,8 +230,8 @@ public class BufferBoundaryCheckTest {
     writableMemory.compareAndSwapLong(0, 0L, 1L);
     try {
       writableMemory.compareAndSwapLong(1, 0L, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java
index 735c6b0..067a9b9 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java
@@ -24,6 +24,7 @@ import static org.testng.Assert.fail;
 
 import java.nio.ByteBuffer;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Buffer;
 import org.apache.datasketches.memory.WritableBuffer;
 import org.apache.datasketches.memory.WritableHandle;
@@ -48,7 +49,7 @@ public class BufferInvariantsTest {
     assertEquals(copyBuff.getStart(), 0);
     assertEquals(copyBuff.getPosition(), 0);
 
-    buff.setStartPositionEnd(1, 1, 5);
+    buff.setAndCheckStartPositionEnd(1, 1, 5);
     buff.getByte();
     Buffer copyBuff2 = buff.region();
     assertEquals(copyBuff2.getEnd(), 3);
@@ -94,18 +95,18 @@ public class BufferInvariantsTest {
     int n = 25;
     WritableBuffer buf = WritableMemory.allocate(n).asWritableBuffer();
     for (byte i = 0; i < n; i++) { buf.putByte(i); }
-    buf.setPosition(0);
+    buf.setAndCheckPosition(0);
     assertEquals(buf.getPosition(), 0);
     assertEquals(buf.getEnd(), 25);
     assertEquals(buf.getCapacity(), 25);
 //    print("Orig  : ");
 //    printbuf(buf);
 
-    buf.setStartPositionEnd(0, 5, 20);
+    buf.setAndCheckStartPositionEnd(0, 5, 20);
     assertEquals(buf.getRemaining(), 15);
     assertEquals(buf.getCapacity(), 25);
     assertEquals(buf.getByte(), 5);
-    buf.setPosition(5);
+    buf.setAndCheckPosition(5);
 //    print("Set   : ");
 //    printbuf(buf);
 
@@ -113,7 +114,7 @@ public class BufferInvariantsTest {
     assertEquals(dup.getRemaining(), 15);
     assertEquals(dup.getCapacity(), 25);
     assertEquals(dup.getByte(), 5);
-    dup.setPosition(5);
+    dup.setAndCheckPosition(5);
 //    print("Dup   : ");
 //    printbuf(dup);
 
@@ -124,7 +125,7 @@ public class BufferInvariantsTest {
     assertEquals(reg.getRemaining(), 15);
     assertEquals(reg.getCapacity(), 15);
     assertEquals(reg.getByte(), 5);
-    reg.setPosition(0);
+    reg.setAndCheckPosition(0);
 //    print("Region: ");
 //    printbuf(reg);
   }
@@ -144,7 +145,7 @@ public class BufferInvariantsTest {
     assertEquals(buf.getRemaining(), 15);
     assertEquals(buf.getCapacity(), 25);
     assertEquals(buf.getByte(), 5);
-    buf.setPosition(5);
+    buf.setAndCheckPosition(5);
 //    print("Buf.wrap: ");
 //    printbuf(buf);
 
@@ -154,7 +155,7 @@ public class BufferInvariantsTest {
     assertEquals(reg.getRemaining(), 15);
     assertEquals(reg.getCapacity(), 15);
     assertEquals(reg.getByte(), 5);
-    reg.setPosition(0);
+    reg.setAndCheckPosition(0);
 //    print("Buf.region: ");
 //    printbuf(reg);
   }
@@ -164,12 +165,12 @@ public class BufferInvariantsTest {
     try (WritableHandle hand = WritableMemory.allocateDirect(100)) {
       WritableMemory wmem = hand.getWritable();
       Buffer buf = wmem.asBuffer();
-      buf.setStartPositionEnd(40, 45, 50);
-      buf.setStartPositionEnd(0, 0, 100);
+      buf.setAndCheckStartPositionEnd(40, 45, 50);
+      buf.setAndCheckStartPositionEnd(0, 0, 100);
       try {
-        buf.setStartPositionEnd(0, 0, 101);
+        buf.setAndCheckStartPositionEnd(0, 0, 101);
         fail();
-      } catch (AssertionError e) {
+      } catch (BoundsException e) {
         //ok
       }
     }
@@ -179,16 +180,16 @@ public class BufferInvariantsTest {
   public void testRegionDirect() {
     ByteBuffer byteBuffer = ByteBuffer.allocate(10);
     byteBuffer.limit(7);
-    Buffer buff = Buffer.wrap(byteBuffer); //assuming buff has cap of 8
-    assertEquals(buff.getCapacity(), 10); //wrong should be 8
+    Buffer buff = Buffer.wrap(byteBuffer);
+    assertEquals(buff.getCapacity(), 10);
     buff.getByte(); //pos moves to 1
-    Buffer copyBuff = buff.region(); //pos: 0, start: 0, end: 6: cap: 7
+    Buffer copyBuff = buff.region(); //buff: start: 0, pos: 1, end: 7, cap: 10
     assertEquals(copyBuff.getEnd(), 6);
     assertEquals(copyBuff.getCapacity(), 6);
     assertEquals(copyBuff.getStart(), 0);
     assertEquals(copyBuff.getPosition(), 0);
 
-    buff.setStartPositionEnd(1, 1, 5);
+    buff.setAndCheckStartPositionEnd(1, 1, 5);
     buff.getByte();
     Buffer copyBuff2 = buff.region();
     assertEquals(copyBuff2.getEnd(), 3);
@@ -236,18 +237,18 @@ public class BufferInvariantsTest {
     WritableMemory wmem = whand.getWritable();
     WritableBuffer buf = wmem.asWritableBuffer();
     for (byte i = 0; i < n; i++) { buf.putByte(i); }
-    buf.setPosition(0);
+    buf.setAndCheckPosition(0);
     assertEquals(buf.getPosition(), 0);
     assertEquals(buf.getEnd(), 25);
     assertEquals(buf.getCapacity(), 25);
 //    print("Orig  : ");
 //    printbuf(buf);
 
-    buf.setStartPositionEnd(0, 5, 20);
+    buf.setAndCheckStartPositionEnd(0, 5, 20);
     assertEquals(buf.getRemaining(), 15);
     assertEquals(buf.getCapacity(), 25);
     assertEquals(buf.getByte(), 5);
-    buf.setPosition(5);
+    buf.setAndCheckPosition(5);
 //    print("Set   : ");
 //    printbuf(buf);
 
@@ -255,7 +256,7 @@ public class BufferInvariantsTest {
     assertEquals(dup.getRemaining(), 15);
     assertEquals(dup.getCapacity(), 25);
     assertEquals(dup.getByte(), 5);
-    dup.setPosition(5);
+    dup.setAndCheckPosition(5);
 //    print("Dup   : ");
 //    printbuf(dup);
 
@@ -266,7 +267,7 @@ public class BufferInvariantsTest {
     assertEquals(reg.getRemaining(), 15);
     assertEquals(reg.getCapacity(), 15);
     assertEquals(reg.getByte(), 5);
-    reg.setPosition(0);
+    reg.setAndCheckPosition(0);
 //    print("Region: ");
 //    printbuf(reg);
     }
@@ -287,7 +288,7 @@ public class BufferInvariantsTest {
     assertEquals(buf.getRemaining(), 15);
     assertEquals(buf.getCapacity(), 25);
     assertEquals(buf.getByte(), 5);
-    buf.setPosition(5);
+    buf.setAndCheckPosition(5);
 //    print("Buf.wrap: ");
 //    printbuf(buf);
 
@@ -297,7 +298,7 @@ public class BufferInvariantsTest {
     assertEquals(reg.getRemaining(), 15);
     assertEquals(reg.getCapacity(), 15);
     assertEquals(reg.getByte(), 5);
-    reg.setPosition(0);
+    reg.setAndCheckPosition(0);
 //    print("Buf.region: ");
 //    printbuf(reg);
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java
index 6f9f62a..73a9da2 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java
@@ -33,82 +33,82 @@ public class BufferReadWriteSafetyTest {
 
   private final WritableBuffer buf = (WritableBuffer) Buffer.wrap(ByteBuffer.allocate(8));
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutByte() {
     buf.putByte(0, (byte) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutBytePositional() {
     buf.putByte((byte) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutBoolean() {
     buf.putBoolean(0, true);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutBooleanPositional() {
     buf.putBoolean(true);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutShort() {
     buf.putShort(0, (short) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutShortPositional() {
     buf.putShort((short) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutChar() {
     buf.putChar(0, (char) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutCharPositional() {
     buf.putChar((char) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutInt() {
     buf.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutIntPositional() {
     buf.putInt(1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutLong() {
     buf.putLong(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutLongPositional() {
     buf.putLong(1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutFloat() {
     buf.putFloat(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutFloatPositional() {
     buf.putFloat(1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutDouble() {
     buf.putDouble(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutDoublePositional() {
     buf.putDouble(1);
   }
@@ -155,19 +155,19 @@ public class BufferReadWriteSafetyTest {
 
   // Now, test that various ways to obtain a read-only buffer produce a read-only buffer indeed
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testWritableMemoryAsBuffer() {
     WritableBuffer buf1 = (WritableBuffer) WritableMemory.allocate(8).asBuffer();
     buf1.putInt(1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testWritableBufferRegion() {
     WritableBuffer buf1 = (WritableBuffer) WritableMemory.allocate(8).asWritableBuffer().region();
     buf1.putInt(1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testWritableBufferDuplicate() {
     WritableBuffer buf1 = (WritableBuffer) WritableMemory.allocate(8).asWritableBuffer().duplicate();
     buf1.putInt(1);
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
index 1c00746..34d341c 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.List;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Buffer;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableBuffer;
@@ -249,7 +250,7 @@ public class BufferTest {
     for (int i = 0; i < n; i++) { arr[i] = i; }
 
     Buffer buf = Memory.wrap(arr).asBuffer();
-    buf.setPosition(n2 * 8);
+    buf.setAndCheckPosition(n2 * 8);
     Buffer reg = buf.region();
     for (int i = 0; i < n2; i++) {
       long v = reg.getLong();
@@ -270,7 +271,7 @@ public class BufferTest {
       //println("" + wmem.getLong(i * 8));
     }
     //println("");
-    wbuf.setPosition(n2 * 8);
+    wbuf.setAndCheckPosition(n2 * 8);
     WritableBuffer reg = wbuf.writableRegion();
     for (int i = 0; i < n2; i++) { reg.putLong(i); } //rewrite top half
     wbuf.resetPosition();
@@ -280,35 +281,30 @@ public class BufferTest {
     }
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test//(expectedExceptions = IllegalStateException.class)
   public void checkParentUseAfterFree() throws Exception {
     int bytes = 64 * 8;
     WritableHandle wh = WritableMemory.allocateDirect(bytes);
     WritableMemory wmem = wh.getWritable();
     WritableBuffer wbuf = wmem.asWritableBuffer();
     wh.close();
-    //with -ea assert: Memory not valid.
-    //with -da sometimes segfaults, sometimes passes!
-    wbuf.getLong();
+    wbuf.getLong(); //Memory not valid
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = IllegalStateException.class)
   public void checkRegionUseAfterFree() throws Exception {
     int bytes = 64;
     WritableHandle wh = WritableMemory.allocateDirect(bytes);
     Memory wmem = wh.get();
-
     Buffer reg = wmem.asBuffer().region();
     wh.close();
-    //with -ea assert: Memory not valid.
-    //with -da sometimes segfaults, sometimes passes!
-    reg.getByte();
+    reg.getByte(); //Memory not valid
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = BoundsException.class)
   public void checkBaseBufferInvariants() {
     WritableBuffer wbuf = WritableMemory.allocate(64).asWritableBuffer();
-    wbuf.setStartPositionEnd(1, 0, 2); //out of order
+    wbuf.setAndCheckStartPositionEnd(1, 0, 2); //out of order
   }
 
 
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java
index e5033a2..3b76891 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java
@@ -21,8 +21,8 @@ package org.apache.datasketches.memory.internal;
 
 import static org.testng.Assert.assertEquals;
 
-import org.apache.datasketches.memory.WritableHandle;
 import org.apache.datasketches.memory.WritableBuffer;
+import org.apache.datasketches.memory.WritableHandle;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
 
@@ -349,7 +349,7 @@ public class CommonBufferTest {
 
     //set region 1
     byte b1 = 5;
-    buf.setStartPositionEnd(reg1Start, reg1Start, reg1Len);
+    buf.setAndCheckStartPositionEnd(reg1Start, reg1Start, reg1Len);
     buf.fill(b1);
     buf.resetPosition();
     for (int i=reg1Start; i<(reg1Len+reg1Start); i++) {
@@ -359,7 +359,7 @@ public class CommonBufferTest {
 
     //set region 2
     byte b2 = 7;
-    buf.setStartPositionEnd(reg2Start, reg2Start, reg2Start + reg2Len);
+    buf.setAndCheckStartPositionEnd(reg2Start, reg2Start, reg2Start + reg2Len);
     buf.fill(b2);
     //println(mem.toHexString("Fill", 0, (int)mem.getCapacity()));
     buf.resetPosition();
@@ -370,7 +370,7 @@ public class CommonBufferTest {
 
     //clear region 1
     byte zeroByte = 0;
-    buf.setStartPositionEnd(reg1Start, reg1Start, reg2Len);
+    buf.setAndCheckStartPositionEnd(reg1Start, reg1Start, reg2Len);
     buf.resetPosition();
     buf.clear();
     buf.resetPosition();
@@ -380,7 +380,7 @@ public class CommonBufferTest {
     //println(buf.toHexString("Region1 cleared", reg1Start, reg1Len));
 
     //clear region 2
-    buf.setStartPositionEnd(reg2Start, reg2Start, reg2Start + reg2Len);
+    buf.setAndCheckStartPositionEnd(reg2Start, reg2Start, reg2Start + reg2Len);
     buf.resetPosition();
     buf.clear();
     buf.resetPosition();
@@ -390,7 +390,7 @@ public class CommonBufferTest {
     //println(buf.toHexString("Region2 cleared", reg2Start, reg2Len));
 
     //set all to ones
-    buf.setStartPositionEnd(reg1Start, reg1Start, accessCapacity);
+    buf.setAndCheckStartPositionEnd(reg1Start, reg1Start, accessCapacity);
     byte b4 = 127;
     buf.resetPosition();
     buf.fill(b4);
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java
index 1362f44..7d0540a 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.datasketches.memory.internal;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.WritableBuffer;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
@@ -32,8 +33,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getBoolean(7);
     try {
       writableBuffer.getBoolean(8);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -43,8 +44,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putBoolean(7, true);
     try {
       writableBuffer.putBoolean(8, true);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -54,8 +55,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getByte(7);
     try {
       writableBuffer.getByte(8);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -65,8 +66,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putByte(7, (byte) 1);
     try {
       writableBuffer.putByte(8, (byte) 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -76,8 +77,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getChar(6);
     try {
       writableBuffer.getChar(7);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -87,8 +88,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putChar(6, 'a');
     try {
       writableBuffer.putChar(7, 'a');
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -98,8 +99,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getShort(6);
     try {
       writableBuffer.getShort(7);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -109,8 +110,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putShort(6, (short) 1);
     try {
       writableBuffer.putShort(7, (short) 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -120,8 +121,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getInt(4);
     try {
       writableBuffer.getInt(5);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -131,8 +132,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putInt(4, 1);
     try {
       writableBuffer.putInt(5, 1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -142,8 +143,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getFloat(4);
     try {
       writableBuffer.getFloat(5);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -153,8 +154,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putFloat(4, 1f);
     try {
       writableBuffer.putFloat(5, 1f);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -164,8 +165,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getLong(0);
     try {
       writableBuffer.getLong(1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -175,8 +176,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putLong(0, 1L);
     try {
       writableBuffer.putLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -186,8 +187,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.getDouble(0);
     try {
       writableBuffer.getDouble(1);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -197,8 +198,8 @@ public class MemoryBoundaryCheckTest {
     writableBuffer.putDouble(0, 1d);
     try {
       writableBuffer.putDouble(1, 1d);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java
index d97fac5..a13a474 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java
@@ -25,6 +25,7 @@ import java.io.File;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.MapHandle;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.ReadOnlyException;
@@ -37,42 +38,42 @@ public class MemoryReadWriteSafetyTest {
 
   final WritableMemory mem = (WritableMemory) Memory.wrap(new byte[8]);
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutByte() {
     mem.putByte(0, (byte) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutBoolean() {
     mem.putBoolean(0, true);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutShort() {
     mem.putShort(0, (short) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutChar() {
     mem.putChar(0, (char) 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutInt() {
     mem.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutLong() {
     mem.putLong(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutFloat() {
     mem.putFloat(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testPutDouble() {
     mem.putDouble(0, 1);
   }
@@ -119,80 +120,80 @@ public class MemoryReadWriteSafetyTest {
 
   // Now, test that various ways to obtain a read-only memory produce a read-only memory indeed
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testWritableMemoryRegion() {
     WritableMemory mem1 = (WritableMemory) WritableMemory.allocate(8).region(0, 8);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testByteArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new byte[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testByteArrayWrapWithBO() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new byte[8], NATIVE_BYTE_ORDER);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testByteArrayWrapWithOffsetsAndBO() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new byte[8], 0, 4, NATIVE_BYTE_ORDER);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testBooleanArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new boolean[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testShortArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new short[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testCharArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new char[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testIntArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new int[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testLongArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new long[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testFloatArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new float[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testDoubleArrayWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(new double[8]);
     mem1.putInt(0, 1);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testByteBufferWrap() {
     WritableMemory mem1 = (WritableMemory) Memory.wrap(ByteBuffer.allocate(8));
     mem1.putInt(0, 1);
   }
 
   //@SuppressWarnings("resource")
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testMapFile() throws Exception {
     File tempFile = File.createTempFile("test", null);
     tempFile.deleteOnExit();
@@ -206,18 +207,18 @@ public class MemoryReadWriteSafetyTest {
   }
 
   @SuppressWarnings("resource")
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = ReadOnlyException.class)
   public void testMapFileWithOffsetsAndBO() throws Exception {
     File tempFile = File.createTempFile("test", "test");
     tempFile.deleteOnExit();
     new RandomAccessFile(tempFile, "rw").setLength(8);
-    try (MapHandle h = Memory.map(tempFile, 0, 4, NATIVE_BYTE_ORDER)) {
-      ((WritableMemory) h.get()).putInt(0, 1);
+    try (MapHandle h = Memory.map(tempFile, 0, 4, NATIVE_BYTE_ORDER)) { //Memory.map forced ReadOnly
+      ((WritableMemory) h.get()).putInt(0, 1); //this is a write
     }
   }
 
   @SuppressWarnings("resource")
-  @Test(expectedExceptions = IllegalArgumentException.class)
+  @Test(expectedExceptions = BoundsException.class)
   public void testMapFileBeyondTheFileSize() throws Exception {
     File tempFile = File.createTempFile("test", "test");
     tempFile.deleteOnExit();
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
index 81e9fd6..0f242d4 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
@@ -318,7 +318,7 @@ public class MemoryTest {
     }
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = IllegalStateException.class)
   public void checkParentUseAfterFree() throws Exception {
     int bytes = 64 * 8;
     WritableHandle wh = WritableMemory.allocateDirect(bytes);
@@ -329,7 +329,7 @@ public class MemoryTest {
     wmem.getLong(0);
   }
 
-  @Test(expectedExceptions = AssertionError.class)
+  @Test(expectedExceptions = IllegalStateException.class)
   public void checkRegionUseAfterFree() throws Exception {
     int bytes = 64;
     WritableHandle wh = WritableMemory.allocateDirect(bytes);
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java
index 0d565a5..1ceb412 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java
@@ -30,6 +30,7 @@ import java.nio.channels.WritableByteChannel;
 import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.datasketches.memory.Memory;
+import org.apache.datasketches.memory.ReadOnlyException;
 import org.apache.datasketches.memory.WritableHandle;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
@@ -57,7 +58,7 @@ public class MemoryWriteToTest {
   }
 
   @Test
-  public void testOffHeap() throws Exception {
+  public void testOffHeap() throws Exception, ReadOnlyException {
     try (WritableHandle handle =
         WritableMemory.allocateDirect((UNSAFE_COPY_THRESHOLD_BYTES * 5) + 10)) {
       WritableMemory mem = handle.getWritable();
@@ -86,12 +87,13 @@ public class MemoryWriteToTest {
     return Memory.wrap(ints);
   }
 
-  private static void testWriteTo(Memory mem) throws IOException {
+  private static void testWriteTo(Memory mem) throws ReadOnlyException, IOException {
     int cap = (int)mem.getCapacity();
     ByteArrayOutputStream baos = new ByteArrayOutputStream(cap);
     try (WritableByteChannel out = Channels.newChannel(baos)) {
       mem.writeTo(0, mem.getCapacity(), out);
-    }
+    } catch (final ReadOnlyException expected) { }
+
     byte[] result = baos.toByteArray();
     assertTrue(mem.equalTo(Memory.wrap(result)));
     //OR
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
index ef9381d..e6ce014 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
@@ -29,6 +29,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.nio.ByteBuffer;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Buffer;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.ReadOnlyException;
@@ -210,8 +211,8 @@ public class NativeWritableBufferImplTest {
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory wmem = wrh.getWritable();
       WritableBuffer wbuf = wmem.asWritableBuffer();
-      wbuf.toHexString("Force Assertion Error", memCapacity, 8);
-    } catch (IllegalArgumentException e) {
+      wbuf.toHexString("Force BoundsException", memCapacity, 8);
+    } catch (BoundsException e) {
       //ok
     }
   }
@@ -224,13 +225,13 @@ public class NativeWritableBufferImplTest {
       WritableBuffer wbuf = wmem.asWritableBuffer();
       byte[] srcArray = { 1, -2, 3, -4 };
       wbuf.putByteArray(srcArray, 0, 5); //wrong!
-    } catch (IllegalArgumentException e) {
+    } catch (BoundsException e) {
       //pass
     }
   }
 
 
-  @Test(expectedExceptions = IllegalArgumentException.class)
+  @Test(expectedExceptions = BoundsException.class)
   public void checkRegionBounds() throws Exception {
     int memCapacity = 64;
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
@@ -440,12 +441,12 @@ public class NativeWritableBufferImplTest {
   public void checkAsBuffer() {
     WritableMemory wmem = WritableMemory.allocate(64);
     WritableBuffer wbuf = wmem.asWritableBuffer();
-    wbuf.setPosition(32);
+    wbuf.setAndCheckPosition(32);
     for (int i = 32; i < 64; i++) { wbuf.putByte((byte)i); }
     //println(wbuf.toHexString("Buf", 0, (int)wbuf.getCapacity()));
 
     Buffer buf = wmem.asBuffer();
-    buf.setPosition(32);
+    buf.setAndCheckPosition(32);
     for (int i = 32; i < 64; i++) {
       assertEquals(buf.getByte(), i);
     }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
index 0356249..3f874dc 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
@@ -29,6 +29,7 @@ import static org.testng.Assert.fail;
 
 import java.nio.ByteBuffer;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Buffer;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.ReadOnlyException;
@@ -207,8 +208,8 @@ public class NativeWritableMemoryImplTest {
     int memCapacity = 64;
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory mem = wrh.getWritable();
-      mem.toHexString("Force Assertion Error", memCapacity, 8);
-    } catch (IllegalArgumentException e) {
+      mem.toHexString("Force Bounds Error", memCapacity, 8);
+    } catch (BoundsException e) {
       //ok
     }
   }
@@ -220,7 +221,7 @@ public class NativeWritableMemoryImplTest {
       WritableMemory mem = wrh.getWritable();
       byte[] srcArray = { 1, -2, 3, -4 };
       mem.putByteArray(0L, srcArray, 0, 5);
-    } catch (IllegalArgumentException e) {
+    } catch (BoundsException e) {
       //pass
     }
   }
@@ -281,9 +282,9 @@ public class NativeWritableMemoryImplTest {
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory mem = wrh.getWritable();
       mem.copyTo(32, mem, 32, 33);  //hit source bound check
-      fail("Did Not Catch Assertion Error: source bound");
+      fail("Did Not Catch bounds error");
     }
-    catch (IllegalArgumentException e) {
+    catch (BoundsException e) {
       //pass
     }
   }
@@ -294,9 +295,9 @@ public class NativeWritableMemoryImplTest {
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory mem = wrh.getWritable();
       mem.copyTo(0, mem, 32, 33);  //hit dst bound check
-      fail("Did Not Catch Assertion Error: dst bound");
+      fail("Did Not Catch Bounds Error: dst bound");
     }
-    catch (IllegalArgumentException e) {
+    catch (BoundsException e) {
       //pass
     }
   }
@@ -426,7 +427,7 @@ public class NativeWritableMemoryImplTest {
 
   }
 
-  @Test(expectedExceptions = IllegalArgumentException.class)
+  @Test(expectedExceptions = BoundsException.class)
   public void checkRegionBounds() throws Exception {
     int memCapacity = 64;
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
@@ -642,12 +643,12 @@ public class NativeWritableMemoryImplTest {
   public void checkAsBuffer() {
     WritableMemory wmem = WritableMemory.allocate(64);
     WritableBuffer wbuf = wmem.asWritableBuffer();
-    wbuf.setPosition(32);
+    wbuf.setAndCheckPosition(32);
     for (int i = 32; i < 64; i++) { wbuf.putByte((byte)i); }
     //println(wbuf.toHexString("Buf", 0, (int)wbuf.getCapacity()));
 
     Buffer buf = wmem.asBuffer();
-    buf.setPosition(32);
+    buf.setAndCheckPosition(32);
     for (int i = 32; i < 64; i++) {
       assertEquals(buf.getByte(), i);
     }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
index d7f0421..31040c9 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
@@ -49,16 +49,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getChar(i * m), ch++);
     }
     ch = 'a';
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putChar(ch++); }
     ch = 'a';
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getChar(), ch++);
     }
     //getArr & putArr
     char[] cArr = new char[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getCharArray(cArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
@@ -82,16 +82,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getDouble(i * m), dbl++);
     }
     dbl = 1.0;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putDouble(dbl++); }
     dbl = 1.0;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getDouble(), dbl++);
     }
     //getArr & putArr
     double[] dblArr = new double[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getDoubleArray(dblArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
@@ -115,16 +115,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getFloat(i * m), flt++);
     }
     flt = 1.0F;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putFloat(flt++); }
     flt = 1.0F;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getFloat(), flt++);
     }
     //getArr & putArr
     float[] fltArr = new float[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getFloatArray(fltArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
@@ -148,16 +148,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getInt(i * m), intg++);
     }
     intg = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putInt(intg++); }
     intg = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getInt(), intg++);
     }
     //getArr & putArr
     int[] intArr = new int[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getIntArray(intArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
@@ -181,16 +181,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getLong(i * m), lng++);
     }
     lng = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putLong(lng++); }
     lng = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getLong(), lng++);
     }
     //getArr & putArr
     long[] longArr = new long[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getLongArray(longArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
@@ -214,16 +214,16 @@ public class NonNativeWritableBufferImplTest {
       assertEquals(wbuf.getShort(i * m), sht++);
     }
     sht = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) { wbuf.putShort(sht++); }
     sht = 1;
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     for (int i = 0; i < n; i++) {
       assertEquals(wbuf.getShort(), sht++);
     }
     //getArr & putArr
     short[] shortArr = new short[n]; //native
-    wbuf.setPosition(0);
+    wbuf.setAndCheckPosition(0);
     wbuf.getShortArray(shortArr, 0, n); //wmem is non-native
     byte[] arr2 = new byte[n * m];
     WritableMemory wmem2 = WritableMemory.writableWrap(arr2, ByteOrder.BIG_ENDIAN);
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
index b544e93..82daab9 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertEquals;
 
 import java.nio.ByteOrder;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
@@ -173,8 +174,8 @@ public class NonNativeWritableMemoryImplTest {
     wmem.getAndAddLong(0, 1L);
     try {
       wmem.getAndAddLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -184,8 +185,8 @@ public class NonNativeWritableMemoryImplTest {
     wmem.getAndSetLong(0, 1L);
     try {
       wmem.getAndSetLong(1, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
@@ -195,8 +196,8 @@ public class NonNativeWritableMemoryImplTest {
     wmem.compareAndSwapLong(0, 0L, 1L);
     try {
       wmem.compareAndSwapLong(1, 0L, 1L);
-      throw new RuntimeException("Expected AssertionError");
-    } catch (final AssertionError expected) {
+      throw new RuntimeException("Expected BoundsException");
+    } catch (final BoundsException expected) {
       // ignore
     }
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java
index 7a8cbff..57c2e62 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java
@@ -48,7 +48,7 @@ public class SpecificLeafTest {
     bb.order(NATIVE_BYTE_ORDER);
 
     Memory mem = Memory.wrap(bb).region(0, bytes, NATIVE_BYTE_ORDER);
-    assertTrue(((BaseStateImpl)mem).isBBType());
+    assertTrue(((BaseStateImpl)mem).isByteBufferType());
     assertTrue(mem.isReadOnly());
     assertTrue(((BaseStateImpl)mem).isMemoryType());
     assertFalse(((BaseStateImpl)mem).isDirectType());
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Utf8Test.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Utf8Test.java
index 762efe3..98d5ee5 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Utf8Test.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Utf8Test.java
@@ -28,6 +28,7 @@ import java.nio.CharBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.Utf8CodingException;
 import org.apache.datasketches.memory.WritableMemory;
@@ -61,12 +62,12 @@ public class Utf8Test {
     WritableMemory mem = WritableMemory.allocate(10);
     WritableMemory emptyMem = WritableMemory.allocate(0);
     for (int c = Character.MIN_SURROGATE; c <= Character.MAX_SURROGATE; c++) {
-      assertSurrogate(mem, (char) c);
-      assertSurrogate(emptyMem, (char) c);
+      confirmSurrogate(mem, (char) c);
+      confirmSurrogate(emptyMem, (char) c);
     }
   }
 
-  private static void assertSurrogate(WritableMemory mem, char c) {
+  private static void confirmSurrogate(WritableMemory mem, char c) {
     try {
       mem.putCharsToUtf8(0, new String(new char[] {c}));
       fail();
@@ -407,7 +408,7 @@ public class Utf8Test {
       Memory mem = Memory.wrap(bytes);
       mem.getCharsFromUtf8(index, size, new StringBuilder());
       fail();
-    } catch (IllegalArgumentException e) { //Pure bounds violation
+    } catch (BoundsException e) { //Pure bounds violation
       // Expected.
     }
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java
index b807aad..f13ca51 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java
@@ -44,6 +44,7 @@ import java.nio.file.attribute.PosixFileAttributeView;
 import java.nio.file.attribute.PosixFileAttributes;
 import java.nio.file.attribute.PosixFilePermissions;
 
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
 
@@ -64,7 +65,7 @@ public class UtilTest {
     assertEquals(idx, -1024);
   }
 
-  @Test(expectedExceptions = IllegalArgumentException.class)
+  @Test(expectedExceptions = BoundsException.class)
   public void checkBoundsTest() {
     checkBounds(999, 2, 1000);
   }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java
index 27b6f55..5c78d42 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java
@@ -19,21 +19,18 @@
 
 package org.apache.datasketches.memory.internal;
 
-import org.apache.datasketches.memory.internal.VirtualMachineMemory;
 import org.testng.annotations.Test;
 
-@SuppressWarnings({"unused"})
 public class VirtualMachineMemoryTest {
 
-    @Test
-    public void maxDirectBufferMemory() {
-       assert(VirtualMachineMemory.getMaxDBBMemory() >= 0);
-    }
+  @Test
+  public void maxDirectByteBufferMemory() {
+    final long max = VirtualMachineMemory.getMaxDBBMemory();
+    //System.out.println("Max DBB Memory = " + max);
 
-    @Test
-    public void inertPageAlignment() {
-      boolean result = VirtualMachineMemory.getIsPageAligned();
-      //System.out.println("VM page alignment:" + result);
-      assert(true); //no exception was thrown
+    if (max == 0) {
+      throw new IllegalStateException("VM MaxDBBMemory must not be zero.");
     }
+  }
+
 }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java
index f52aa34..a47a28a 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java
@@ -22,8 +22,9 @@ package org.apache.datasketches.memory.internal;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
-import org.apache.datasketches.memory.WritableHandle;
+import org.apache.datasketches.memory.BoundsException;
 import org.apache.datasketches.memory.Memory;
+import org.apache.datasketches.memory.WritableHandle;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
 
@@ -98,8 +99,8 @@ public class WritableDirectCopyTest {
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory mem = wrh.getWritable();
       mem.copyTo(32, mem, 32, 33);  //hit source bound check
-      fail("Did Not Catch Assertion Error: source bound");
-    } catch (IllegalArgumentException e) {
+      fail("Did Not Catch bounds error");
+    } catch (BoundsException e) {
       //pass
     }
   }
@@ -110,8 +111,8 @@ public class WritableDirectCopyTest {
     try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
       WritableMemory mem = wrh.getWritable();
       mem.copyTo(0, mem, 32, 33);  //hit dst bound check
-      fail("Did Not Catch Assertion Error: dst bound");
-    } catch (IllegalArgumentException e) {
+      fail("Did Not Catch bounds error");
+    } catch (BoundsException e) {
       //pass
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org