mirror of https://github.com/apache/lucene.git
LUCENE-5152: make assert less costly
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1514520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f02170a048
commit
51da0631c0
|
@ -1140,7 +1140,6 @@ public final class FST<T> {
|
|||
/** Finds an arc leaving the incoming arc, replacing the arc in place.
|
||||
* This returns null if the arc was not found, else the incoming arc. */
|
||||
public Arc<T> findTargetArc(int labelToMatch, Arc<T> follow, Arc<T> arc, BytesReader in) throws IOException {
|
||||
assert assertRootArcs();
|
||||
|
||||
if (labelToMatch == END_LABEL) {
|
||||
if (follow.isFinal()) {
|
||||
|
@ -1162,6 +1161,10 @@ public final class FST<T> {
|
|||
|
||||
// Short-circuit if this arc is in the root arc cache:
|
||||
if (follow.target == startNode && labelToMatch < cachedRootArcs.length) {
|
||||
|
||||
// LUCENE-5152: detect tricky cases where caller
|
||||
// modified previously returned cached root-arcs:
|
||||
assert assertRootArcs();
|
||||
final Arc<T> result = cachedRootArcs[labelToMatch];
|
||||
if (result == null) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue