mirror of https://github.com/apache/lucene.git
Turn some "assert false" in switch and switch-like statements into AssertionErrors. If we get into the default block we are wrong and we can also throw Ex, because then there is logic error (e.g. after new enum constant was added)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1379450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
63a95f1175
commit
8f88aa6497
|
@ -170,7 +170,7 @@ public class DocMaker implements Closeable {
|
|||
f = new DoubleField(name, 0.0, Field.Store.NO);
|
||||
break;
|
||||
default:
|
||||
assert false;
|
||||
throw new AssertionError("Cannot get here");
|
||||
}
|
||||
if (reuseFields) {
|
||||
numericFields.put(name, f);
|
||||
|
|
|
@ -186,7 +186,7 @@ public final class Lucene40StoredFieldsWriter extends StoredFieldsWriter {
|
|||
} else if (number instanceof Double) {
|
||||
fieldsStream.writeLong(Double.doubleToLongBits(number.doubleValue()));
|
||||
} else {
|
||||
assert false;
|
||||
throw new AssertionError("Cannot get here");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ public class Field implements IndexableField {
|
|||
nts.setDoubleValue(val.doubleValue());
|
||||
break;
|
||||
default:
|
||||
assert false : "Should never get here";
|
||||
throw new AssertionError("Should never get here");
|
||||
}
|
||||
return internalTokenStream;
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ final class DocumentsWriter {
|
|||
|
||||
if (!perThread.isActive()) {
|
||||
ensureOpen();
|
||||
assert false: "perThread is not active but we are still open";
|
||||
throw new IllegalStateException("perThread is not active but we are still open");
|
||||
}
|
||||
|
||||
final DocumentsWriterPerThread dwpt = perThread.dwpt;
|
||||
|
|
|
@ -324,7 +324,7 @@ final class DocumentsWriterDeleteQueue {
|
|||
.newUpdater(Node.class, Node.class, "next");
|
||||
|
||||
void apply(BufferedDeletes bufferedDeletes, int docIDUpto) {
|
||||
assert false : "sentinel item must never be applied";
|
||||
throw new IllegalStateException("sentinel item must never be applied");
|
||||
}
|
||||
|
||||
boolean casNext(Node<?> cmp, Node<?> val) {
|
||||
|
|
|
@ -401,8 +401,8 @@ public final class MultiTermsEnum extends TermsEnum {
|
|||
subDocs[upto].slice = entry.subSlice;
|
||||
upto++;
|
||||
} else {
|
||||
// One of our subs cannot provide a docsenum:
|
||||
assert false;
|
||||
// should this be an error?
|
||||
assert false : "One of our subs cannot provide a docsenum";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,8 +362,7 @@ public abstract class BufferedIndexInput extends IndexInput {
|
|||
case MERGE:
|
||||
return MERGE_BUFFER_SIZE;
|
||||
default:
|
||||
assert false : "unknown IOContext " + context.context;
|
||||
return BUFFER_SIZE;
|
||||
throw new AssertionError("unknown IOContext " + context.context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ public class TestNumericQueryParser extends LuceneTestCase {
|
|||
field = new DoubleField(type.name(), 0.0, ft);
|
||||
break;
|
||||
default:
|
||||
assert false;
|
||||
fail();
|
||||
field = null;
|
||||
}
|
||||
numericFieldMap.put(type.name(), field);
|
||||
|
|
Loading…
Reference in New Issue