diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 6c62aab5235..4ac3169d315 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -131,6 +131,8 @@ Optimizations * LUCENE-7371: Point values are now better compressed using run-length encoding. (Adrien Grand) +* LUCENE-7385: Improve/fix assert messages in SpanScorer. (David Smiley) + Other * LUCENE-4787: Fixed some highlighting javadocs. (Michael Dodsworth via Adrien diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java index 4841ddcb990..508a2b37da2 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java @@ -87,13 +87,13 @@ public class SpanScorer extends Scorer { spans.doStartCurrentDoc(); - assert spans.startPosition() == -1 : "incorrect initial start position, " + this.toString(); - assert spans.endPosition() == -1 : "incorrect initial end position, " + this.toString(); + assert spans.startPosition() == -1 : "incorrect initial start position, " + spans; + assert spans.endPosition() == -1 : "incorrect initial end position, " + spans; int prevStartPos = -1; int prevEndPos = -1; int startPos = spans.nextStartPosition(); - assert startPos != Spans.NO_MORE_POSITIONS : "initial startPos NO_MORE_POSITIONS, " + this.toString(); + assert startPos != Spans.NO_MORE_POSITIONS : "initial startPos NO_MORE_POSITIONS, " + spans; do { assert startPos >= prevStartPos; int endPos = spans.endPosition(); @@ -113,8 +113,8 @@ public class SpanScorer extends Scorer { startPos = spans.nextStartPosition(); } while (startPos != Spans.NO_MORE_POSITIONS); - assert spans.startPosition() == Spans.NO_MORE_POSITIONS : "incorrect final start position, " + this.toString(); - assert spans.endPosition() == Spans.NO_MORE_POSITIONS : "incorrect final end position, " + this.toString(); + assert spans.startPosition() == Spans.NO_MORE_POSITIONS : "incorrect final start position, " + spans; + assert spans.endPosition() == Spans.NO_MORE_POSITIONS : "incorrect final end position, " + spans; } /**