Skip to content

Commit 9c92281

Browse files
authored
Simplify Lucene60 and Luene62 codec constructors (elastic#124054) (elastic#124092)
The only public constructor needed in the archive index codecs is the default one, as that's called by SPI. The other one will only ever be called by the default one, hence we can merge the two into one and simplify things a bit.
1 parent 86a923a commit 9c92281

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/Lucene60Codec.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
import org.elasticsearch.xpack.lucene.bwc.codecs.lucene50.Lucene50SegmentInfoFormat;
3939
import org.elasticsearch.xpack.lucene.bwc.codecs.lucene54.Lucene54DocValuesFormat;
4040

41-
import java.util.Objects;
42-
4341
/**
4442
* Implements the Lucene 6.0 index format.
4543
*
@@ -71,21 +69,12 @@ protected PostingsFormat getPostingsFormat(String formatName) {
7169
};
7270

7371
/**
74-
* Instantiates a new codec.
72+
* Instantiates a new codec. Called by SPI.
7573
*/
74+
@SuppressWarnings("unused")
7675
public Lucene60Codec() {
77-
this(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
78-
}
79-
80-
/**
81-
* Instantiates a new codec, specifying the stored fields compression
82-
* mode to use.
83-
* @param mode stored fields compression mode to use for newly
84-
* flushed/merged segments.
85-
*/
86-
public Lucene60Codec(Lucene50StoredFieldsFormat.Mode mode) {
8776
super("Lucene60");
88-
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Objects.requireNonNull(mode));
77+
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
8978
}
9079

9180
@Override

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene62/Lucene62Codec.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
import org.elasticsearch.xpack.lucene.bwc.codecs.lucene54.Lucene54DocValuesFormat;
3939
import org.elasticsearch.xpack.lucene.bwc.codecs.lucene60.Lucene60MetadataOnlyPointsFormat;
4040

41-
import java.util.Objects;
42-
4341
/**
4442
* Implements the Lucene 6.2 index format.
4543
*
@@ -70,13 +68,13 @@ protected PostingsFormat getPostingsFormat(String formatName) {
7068
}
7169
};
7270

71+
/**
72+
* Instantiates a new codec. Called by SPI.
73+
*/
74+
@SuppressWarnings("unused")
7375
public Lucene62Codec() {
74-
this(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
75-
}
76-
77-
public Lucene62Codec(Lucene50StoredFieldsFormat.Mode mode) {
7876
super("Lucene62");
79-
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Objects.requireNonNull(mode));
77+
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
8078
}
8179

8280
@Override

0 commit comments

Comments
 (0)