From 88adeb0b281d0228b5c9521934436bbc5cab4ef4 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Tue, 18 Sep 2012 15:57:02 +0000 Subject: [PATCH] LUCENE-4391: Make Lucene40Codec's methods final. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1387222 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 4 + .../codecs/appending/AppendingCodec.java | 66 ++----------- .../appending/AppendingPostingsFormat.java | 2 +- .../bloom/BloomFilteringPostingsFormat.java | 2 +- .../codecs/memory/DirectPostingsFormat.java | 2 +- .../codecs/memory/MemoryPostingsFormat.java | 2 +- .../simpletext/SimpleTextPostingsFormat.java | 2 +- .../org/apache/lucene/codecs/FilterCodec.java | 96 +++++++++++++++++++ .../lucene/codecs/lucene40/Lucene40Codec.java | 22 +++-- .../lucene40/Lucene40PostingsFormat.java | 2 +- .../perfield/PerFieldPostingsFormat.java | 4 +- .../apache/lucene/index/TestAddIndexes.java | 56 +---------- .../codecs/asserting/AssertingCodec.java | 59 ++---------- .../asserting/AssertingPostingsFormat.java | 2 +- .../TestBloomFilteredLucene40Postings.java | 2 +- .../codecs/lucene40ords/Lucene40WithOrds.java | 2 +- .../MockFixedIntBlockPostingsFormat.java | 2 +- .../MockVariableIntBlockPostingsFormat.java | 2 +- .../mockrandom/MockRandomPostingsFormat.java | 2 +- .../codecs/mocksep/MockSepPostingsFormat.java | 2 +- .../NestedPulsingPostingsFormat.java | 2 +- .../codecs/ramonly/RAMOnlyPostingsFormat.java | 2 +- 22 files changed, 152 insertions(+), 185 deletions(-) create mode 100644 lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 2f95b76cd29..0a15f2513bd 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -52,6 +52,10 @@ New Features API Changes +* LUCENE-4391: All methods of Lucene40Codec but getPostingsFormatForField are + now final. To reuse functionality of Lucene40, you should extend FilterCodec + and delegate to Lucene40 instead of extending Lucene40Codec. (Adrien Grand) + * LUCENE-4299: Added Terms.hasPositions() and Terms.hasOffsets(). Previously you had no real way to know that a term vector field had positions or offsets, since this can be configured on a diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingCodec.java b/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingCodec.java index df780f714b9..4ca14094827 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingCodec.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingCodec.java @@ -18,22 +18,9 @@ package org.apache.lucene.codecs.appending; */ import org.apache.lucene.codecs.Codec; -import org.apache.lucene.codecs.DocValuesFormat; -import org.apache.lucene.codecs.FieldInfosFormat; -import org.apache.lucene.codecs.LiveDocsFormat; -import org.apache.lucene.codecs.NormsFormat; +import org.apache.lucene.codecs.FilterCodec; import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.SegmentInfoFormat; -import org.apache.lucene.codecs.StoredFieldsFormat; -import org.apache.lucene.codecs.TermVectorsFormat; import org.apache.lucene.codecs.lucene40.Lucene40Codec; -import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat; -import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat; -import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat; -import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat; /** * This codec uses an index format that is very similar to @@ -42,57 +29,22 @@ import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat; * * @lucene.experimental */ -public class AppendingCodec extends Codec { +public final class AppendingCodec extends FilterCodec { + public AppendingCodec() { super("Appending"); } private final PostingsFormat postings = new AppendingPostingsFormat(); - private final SegmentInfoFormat infos = new Lucene40SegmentInfoFormat(); - private final StoredFieldsFormat fields = new Lucene40StoredFieldsFormat(); - private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat(); - private final TermVectorsFormat vectors = new Lucene40TermVectorsFormat(); - private final DocValuesFormat docValues = new Lucene40DocValuesFormat(); - private final NormsFormat norms = new Lucene40NormsFormat(); - private final LiveDocsFormat liveDocs = new Lucene40LiveDocsFormat(); - + + @Override + protected Codec delegate() { + return Codec.forName("Lucene40"); + } + @Override public PostingsFormat postingsFormat() { return postings; } - @Override - public StoredFieldsFormat storedFieldsFormat() { - return fields; - } - - @Override - public TermVectorsFormat termVectorsFormat() { - return vectors; - } - - @Override - public DocValuesFormat docValuesFormat() { - return docValues; - } - - @Override - public SegmentInfoFormat segmentInfoFormat() { - return infos; - } - - @Override - public FieldInfosFormat fieldInfosFormat() { - return fieldInfos; - } - - @Override - public NormsFormat normsFormat() { - return norms; - } - - @Override - public LiveDocsFormat liveDocsFormat() { - return liveDocs; - } } diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingPostingsFormat.java index 2f721788b95..a96b3a6169b 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/appending/AppendingPostingsFormat.java @@ -33,7 +33,7 @@ import org.apache.lucene.index.SegmentWriteState; /** * Appending postings impl. */ -class AppendingPostingsFormat extends PostingsFormat { +final class AppendingPostingsFormat extends PostingsFormat { public static String CODEC_NAME = "Appending"; public AppendingPostingsFormat() { diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java index 525a0ac90b0..4836391b80f 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java @@ -80,7 +80,7 @@ import org.apache.lucene.util.automaton.CompiledAutomaton; * * @lucene.experimental */ -public class BloomFilteringPostingsFormat extends PostingsFormat { +public final class BloomFilteringPostingsFormat extends PostingsFormat { public static final String BLOOM_CODEC_NAME = "BloomFilter"; public static final int BLOOM_CODEC_VERSION = 1; diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java index 98e1a36ae85..97e22f4a03d 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java @@ -71,7 +71,7 @@ import org.apache.lucene.util.automaton.Transition; * * @lucene.experimental */ -public class DirectPostingsFormat extends PostingsFormat { +public final class DirectPostingsFormat extends PostingsFormat { private final int minSkipCount; private final int lowFreqCutoff; diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java index 6bf8bc8cf6d..3dab4df65c3 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java @@ -79,7 +79,7 @@ import org.apache.lucene.util.packed.PackedInts; // TODO: Maybe name this 'Cached' or something to reflect // the reality that it is actually written to disk, but // loads itself in ram? -public class MemoryPostingsFormat extends PostingsFormat { +public final class MemoryPostingsFormat extends PostingsFormat { private final boolean doPackFST; private final float acceptableOverheadRatio; diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPostingsFormat.java index 4f7cfe086e9..5a5cf54a337 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPostingsFormat.java @@ -34,7 +34,7 @@ import org.apache.lucene.index.IndexFileNames; * any text editor, and even edit it to alter your index. * * @lucene.experimental */ -public class SimpleTextPostingsFormat extends PostingsFormat { +public final class SimpleTextPostingsFormat extends PostingsFormat { public SimpleTextPostingsFormat() { super("SimpleText"); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java b/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java new file mode 100644 index 00000000000..768c53fa68c --- /dev/null +++ b/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java @@ -0,0 +1,96 @@ +package org.apache.lucene.codecs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A codec that forwards all its method calls to another codec. + *

+ * Extend this class when you need to reuse the functionality of an existing + * codec. For example, if you want to build a codec that redefines Lucene40's + * {@link LiveDocsFormat}: + *

+ *   public final class CustomCodec extends FilterCodec {
+ *
+ *     public CustomCodec() {
+ *       super("CustomCodec");
+ *     }
+ *
+ *     public Codec delegate() {
+ *       return Codec.forName("Lucene40");
+ *     }
+ *
+ *     public LiveDocsFormat liveDocsFormat() {
+ *       return new CustomLiveDocsFormat();
+ *     }
+ *
+ *   }
+ * 
+ */ +public abstract class FilterCodec extends Codec { + + public FilterCodec(String name) { + super(name); + } + + /** + * Return the codec that is responsible for providing default format + * implementations. + */ + protected abstract Codec delegate(); + + @Override + public DocValuesFormat docValuesFormat() { + return delegate().docValuesFormat(); + } + + @Override + public FieldInfosFormat fieldInfosFormat() { + return delegate().fieldInfosFormat(); + } + + @Override + public LiveDocsFormat liveDocsFormat() { + return delegate().liveDocsFormat(); + } + + @Override + public NormsFormat normsFormat() { + return delegate().normsFormat(); + } + + @Override + public PostingsFormat postingsFormat() { + return delegate().postingsFormat(); + } + + @Override + public SegmentInfoFormat segmentInfoFormat() { + return delegate().segmentInfoFormat(); + } + + @Override + public StoredFieldsFormat storedFieldsFormat() { + return delegate().storedFieldsFormat(); + } + + @Override + public TermVectorsFormat termVectorsFormat() { + return delegate().termVectorsFormat(); + } + +} diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40Codec.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40Codec.java index ee5f57adc4b..69d979ceec9 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40Codec.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40Codec.java @@ -20,6 +20,7 @@ package org.apache.lucene.codecs.lucene40; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.FieldInfosFormat; +import org.apache.lucene.codecs.FilterCodec; import org.apache.lucene.codecs.LiveDocsFormat; import org.apache.lucene.codecs.NormsFormat; import org.apache.lucene.codecs.PostingsFormat; @@ -30,7 +31,10 @@ import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; /** * Implements the Lucene 4.0 index format, with configurable per-field postings formats. - * + *

+ * If you want to reuse functionality of this codec in another codec, extend + * {@link FilterCodec}. + * * @see org.apache.lucene.codecs.lucene40 package documentation for file format details. * @lucene.experimental */ @@ -58,42 +62,42 @@ public class Lucene40Codec extends Codec { } @Override - public StoredFieldsFormat storedFieldsFormat() { + public final StoredFieldsFormat storedFieldsFormat() { return fieldsFormat; } @Override - public TermVectorsFormat termVectorsFormat() { + public final TermVectorsFormat termVectorsFormat() { return vectorsFormat; } @Override - public DocValuesFormat docValuesFormat() { + public final DocValuesFormat docValuesFormat() { return docValuesFormat; } @Override - public PostingsFormat postingsFormat() { + public final PostingsFormat postingsFormat() { return postingsFormat; } @Override - public FieldInfosFormat fieldInfosFormat() { + public final FieldInfosFormat fieldInfosFormat() { return fieldInfosFormat; } @Override - public SegmentInfoFormat segmentInfoFormat() { + public final SegmentInfoFormat segmentInfoFormat() { return infosFormat; } @Override - public NormsFormat normsFormat() { + public final NormsFormat normsFormat() { return normsFormat; } @Override - public LiveDocsFormat liveDocsFormat() { + public final LiveDocsFormat liveDocsFormat() { return liveDocsFormat; } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsFormat.java index e1aefd0a0d2..19ec77e264d 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsFormat.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsFormat.java @@ -269,7 +269,7 @@ import org.apache.lucene.util.fst.FST; // javadocs // TODO: this class could be created by wrapping // BlockTreeTermsDict around Lucene40PostingsBaseFormat; ie // we should not duplicate the code from that class here: -public class Lucene40PostingsFormat extends PostingsFormat { +public final class Lucene40PostingsFormat extends PostingsFormat { private final int minBlockSize; private final int maxBlockSize; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldPostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldPostingsFormat.java index 3e6e27dfd24..2e35e279c91 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldPostingsFormat.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldPostingsFormat.java @@ -63,7 +63,7 @@ public abstract class PerFieldPostingsFormat extends PostingsFormat { } @Override - public FieldsConsumer fieldsConsumer(SegmentWriteState state) + public final FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException { return new FieldsWriter(state); } @@ -220,7 +220,7 @@ public abstract class PerFieldPostingsFormat extends PostingsFormat { } @Override - public FieldsProducer fieldsProducer(SegmentReadState state) + public final FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { return new FieldsReader(state); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java b/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java index 33e51a8cc25..f2311a2dc18 100755 --- a/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java @@ -25,22 +25,9 @@ import java.util.List; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.codecs.Codec; -import org.apache.lucene.codecs.DocValuesFormat; -import org.apache.lucene.codecs.FieldInfosFormat; -import org.apache.lucene.codecs.LiveDocsFormat; -import org.apache.lucene.codecs.NormsFormat; +import org.apache.lucene.codecs.FilterCodec; import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.SegmentInfoFormat; -import org.apache.lucene.codecs.StoredFieldsFormat; -import org.apache.lucene.codecs.TermVectorsFormat; import org.apache.lucene.codecs.lucene40.Lucene40Codec; -import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat; -import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat; -import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat; -import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat; import org.apache.lucene.codecs.pulsing.Pulsing40PostingsFormat; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -1120,49 +1107,14 @@ public class TestAddIndexes extends LuceneTestCase { dir.close(); } - private static class UnRegisteredCodec extends Codec { + private static final class UnRegisteredCodec extends FilterCodec { public UnRegisteredCodec() { super("NotRegistered"); } @Override - public PostingsFormat postingsFormat() { - return PostingsFormat.forName("Lucene40"); - } - - @Override - public DocValuesFormat docValuesFormat() { - return new Lucene40DocValuesFormat(); - } - - @Override - public StoredFieldsFormat storedFieldsFormat() { - return new Lucene40StoredFieldsFormat(); - } - - @Override - public TermVectorsFormat termVectorsFormat() { - return new Lucene40TermVectorsFormat(); - } - - @Override - public FieldInfosFormat fieldInfosFormat() { - return new Lucene40FieldInfosFormat(); - } - - @Override - public SegmentInfoFormat segmentInfoFormat() { - return new Lucene40SegmentInfoFormat(); - } - - @Override - public NormsFormat normsFormat() { - return new Lucene40NormsFormat(); - } - - @Override - public LiveDocsFormat liveDocsFormat() { - return new Lucene40LiveDocsFormat(); + protected Codec delegate() { + return Codec.forName("Lucene40"); } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingCodec.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingCodec.java index 30f10e6753a..457fa12baf1 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingCodec.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingCodec.java @@ -18,77 +18,36 @@ package org.apache.lucene.codecs.asserting; */ import org.apache.lucene.codecs.Codec; -import org.apache.lucene.codecs.DocValuesFormat; -import org.apache.lucene.codecs.FieldInfosFormat; -import org.apache.lucene.codecs.LiveDocsFormat; -import org.apache.lucene.codecs.NormsFormat; +import org.apache.lucene.codecs.FilterCodec; import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.SegmentInfoFormat; -import org.apache.lucene.codecs.StoredFieldsFormat; import org.apache.lucene.codecs.TermVectorsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40Codec; // javadocs @link -import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat; -import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat; -import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat; -import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat; -import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat; +import org.apache.lucene.codecs.lucene40.Lucene40Codec; /** * Acts like {@link Lucene40Codec} but with additional asserts. */ -public class AssertingCodec extends Codec { +public final class AssertingCodec extends FilterCodec { private final PostingsFormat postings = new AssertingPostingsFormat(); - private final SegmentInfoFormat infos = new Lucene40SegmentInfoFormat(); - private final StoredFieldsFormat fields = new Lucene40StoredFieldsFormat(); - private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat(); private final TermVectorsFormat vectors = new AssertingTermVectorsFormat(); - private final DocValuesFormat docValues = new Lucene40DocValuesFormat(); - private final NormsFormat norms = new Lucene40NormsFormat(); - private final LiveDocsFormat liveDocs = new Lucene40LiveDocsFormat(); - + public AssertingCodec() { super("Asserting"); } + @Override + protected Codec delegate() { + return Codec.forName("Lucene40"); + } + @Override public PostingsFormat postingsFormat() { return postings; } - @Override - public DocValuesFormat docValuesFormat() { - return docValues; - } - - @Override - public StoredFieldsFormat storedFieldsFormat() { - return fields; - } - @Override public TermVectorsFormat termVectorsFormat() { return vectors; } - @Override - public FieldInfosFormat fieldInfosFormat() { - return fieldInfos; - } - - @Override - public SegmentInfoFormat segmentInfoFormat() { - return infos; - } - - @Override - public NormsFormat normsFormat() { - return norms; - } - - @Override - public LiveDocsFormat liveDocsFormat() { - return liveDocs; - } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java index 682c0c6252a..775f972a1eb 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java @@ -40,7 +40,7 @@ import org.apache.lucene.util.OpenBitSet; /** * Just like {@link Lucene40PostingsFormat} but with additional asserts. */ -public class AssertingPostingsFormat extends PostingsFormat { +public final class AssertingPostingsFormat extends PostingsFormat { private final PostingsFormat in = new Lucene40PostingsFormat(); public AssertingPostingsFormat() { diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java index 141c6f5896e..50c5a98bdfa 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/bloom/TestBloomFilteredLucene40Postings.java @@ -34,7 +34,7 @@ import org.apache.lucene.index.SegmentWriteState; * APPLICATION This is not a realistic application of Bloom Filters as they * ordinarily are larger and operate on only primary key type fields. */ -public class TestBloomFilteredLucene40Postings extends PostingsFormat { +public final class TestBloomFilteredLucene40Postings extends PostingsFormat { private BloomFilteringPostingsFormat delegate; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40ords/Lucene40WithOrds.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40ords/Lucene40WithOrds.java index ae5da6e3989..42f0d853688 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40ords/Lucene40WithOrds.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40ords/Lucene40WithOrds.java @@ -44,7 +44,7 @@ import org.apache.lucene.util.BytesRef; * Customized version of {@link Lucene40Codec} that uses * {@link FixedGapTermsIndexWriter}. */ -public class Lucene40WithOrds extends PostingsFormat { +public final class Lucene40WithOrds extends PostingsFormat { public Lucene40WithOrds() { super("Lucene40WithOrds"); diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java index e3eec01b46a..0cf67795cc5 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java @@ -49,7 +49,7 @@ import org.apache.lucene.util.IOUtils; * used here just writes each block as a series of vInt. */ -public class MockFixedIntBlockPostingsFormat extends PostingsFormat { +public final class MockFixedIntBlockPostingsFormat extends PostingsFormat { private final int blockSize; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java index 12db9deb729..bb9195ee7ff 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java @@ -53,7 +53,7 @@ import org.apache.lucene.util.IOUtils; * int is <= 3, else 2*baseBlockSize. */ -public class MockVariableIntBlockPostingsFormat extends PostingsFormat { +public final class MockVariableIntBlockPostingsFormat extends PostingsFormat { private final int baseBlockSize; public MockVariableIntBlockPostingsFormat() { diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java index 3fe63484925..97348380255 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java @@ -66,7 +66,7 @@ import org.apache.lucene.util._TestUtil; * Randomly combines terms index impl w/ postings impls. */ -public class MockRandomPostingsFormat extends PostingsFormat { +public final class MockRandomPostingsFormat extends PostingsFormat { private final Random seedRandom; private final String SEED_EXT = "sd"; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java index c75950949b4..d954d4625e2 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java @@ -42,7 +42,7 @@ import org.apache.lucene.util.BytesRef; * This is here just to test the core sep codec * classes. */ -public class MockSepPostingsFormat extends PostingsFormat { +public final class MockSepPostingsFormat extends PostingsFormat { public MockSepPostingsFormat() { super("MockSep"); diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/nestedpulsing/NestedPulsingPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/nestedpulsing/NestedPulsingPostingsFormat.java index 69bbbc0ef90..c44f3ef5db7 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/nestedpulsing/NestedPulsingPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/nestedpulsing/NestedPulsingPostingsFormat.java @@ -41,7 +41,7 @@ import org.apache.lucene.util.IOUtils; // TODO: if we create PulsingPostingsBaseFormat then we // can simplify this? note: I don't like the *BaseFormat // hierarchy, maybe we can clean that up... -public class NestedPulsingPostingsFormat extends PostingsFormat { +public final class NestedPulsingPostingsFormat extends PostingsFormat { public NestedPulsingPostingsFormat() { super("NestedPulsing"); } diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java index 1565e45cbc3..fddd4da451f 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java @@ -57,7 +57,7 @@ import org.apache.lucene.util.IOUtils; * * NOTE: this codec sorts terms by reverse-unicode-order! */ -public class RAMOnlyPostingsFormat extends PostingsFormat { +public final class RAMOnlyPostingsFormat extends PostingsFormat { // For fun, test that we can override how terms are // sorted, and basic things still work -- this comparator