diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
index 26f9bcbcb25..ea0c7932318 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
@@ -345,11 +345,7 @@ final class SegmentMerger {
private void mergePerDoc(SegmentWriteState segmentWriteState) throws IOException {
final PerDocConsumer docsConsumer = codec.docValuesFormat()
.docsConsumer(new PerDocWriteState(segmentWriteState));
- // TODO: remove this check when 3.x indexes are no longer supported
- // (3.x indexes don't have docvalues)
- if (docsConsumer == null) {
- return;
- }
+ assert docsConsumer != null;
boolean success = false;
try {
docsConsumer.merge(mergeState);
@@ -366,11 +362,7 @@ final class SegmentMerger {
private void mergeNorms(SegmentWriteState segmentWriteState) throws IOException {
final PerDocConsumer docsConsumer = codec.normsFormat()
.docsConsumer(new PerDocWriteState(segmentWriteState));
- // TODO: remove this check when 3.x indexes are no longer supported
- // (3.x indexes don't have docvalues)
- if (docsConsumer == null) {
- return;
- }
+ assert docsConsumer != null;
boolean success = false;
try {
docsConsumer.merge(mergeState);
diff --git a/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java b/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java
index a0a4a9f9938..d6979756eb8 100644
--- a/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java
+++ b/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java
@@ -73,8 +73,8 @@ public class BM25Similarity extends Similarity {
}
/** The default implementation computes the average as sumTotalTermFreq / maxDoc
,
- * or returns 1
if the index does not store sumTotalTermFreq (Lucene 3.x indexes
- * or any field that omits frequency information). */
+ * or returns 1
if the index does not store sumTotalTermFreq:
+ * any field that omits frequency information). */
protected float avgFieldLength(CollectionStatistics collectionStats) {
final long sumTotalTermFreq = collectionStats.sumTotalTermFreq();
if (sumTotalTermFreq <= 0) {