remove InternalError

This commit is contained in:
David Renshaw 2014-10-02 12:23:29 -04:00
parent c0da82a6b8
commit df389a939b
3 changed files with 3 additions and 12 deletions

View file

@ -1,7 +0,0 @@
package org.capnproto;
public final class InternalError extends RuntimeException {
public InternalError(String message) {
super(message);
}
}

View file

@ -28,9 +28,7 @@ public final class SegmentBuilder extends SegmentReader {
Allocate `amount` words.
*/
public final int allocate(int amount) {
if (amount < 0) {
throw new InternalError("tried to allocate a negative number of words");
}
assert amount >= 0 : "tried to allocate a negative number of words";
if (amount > this.capacity() - this.currentSize()) {
return FAILED_ALLOCATION; // no space left;

View file

@ -181,7 +181,7 @@ final class WireHelpers {
SegmentBuilder segment,
int elementCount,
byte elementSize) {
assert elementSize == FieldSize.INLINE_COMPOSITE : "Should have called initStructListPointer instead";
assert elementSize != FieldSize.INLINE_COMPOSITE : "Should have called initStructListPointer instead";
int dataSize = FieldSize.dataBitsPerElement(elementSize);
int pointerCount = FieldSize.pointersPerElement(elementSize);
@ -228,7 +228,7 @@ final class WireHelpers {
public static ListBuilder getWritableListPointer(int origRefOffset,
SegmentBuilder origSegment,
byte elementSize) {
assert elementSize == FieldSize.INLINE_COMPOSITE : "Use getStructList{Element,Field} for structs";
assert elementSize != FieldSize.INLINE_COMPOSITE : "Use getStructList{Element,Field} for structs";
long origRef = WirePointer.get(origSegment.buffer, origRefOffset);
int origRefTarget = WirePointer.target(origRefOffset, origRef);