diff --git a/gradle/validation/ecj-lint/ecj.javadocs.prefs b/gradle/validation/ecj-lint/ecj.javadocs.prefs index 8bfb42da977..b85d32aa47c 100644 --- a/gradle/validation/ecj-lint/ecj.javadocs.prefs +++ b/gradle/validation/ecj-lint/ecj.javadocs.prefs @@ -85,7 +85,7 @@ org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=error diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilter.java index bfdfb4316bf..6c938268336 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilter.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilter.java @@ -147,6 +147,9 @@ public final class ConcatenateGraphFilter extends TokenStream { super.reset(); // we only capture this if we really need it to save the UTF-8 to UTF-16 conversion charTermAttribute = getAttribute(CharTermAttribute.class); // may return null + // make sure the TermToBytesRefAttribute attribute is implemented by our class, not via + // CharTermAttribute's + assert getAttribute(TermToBytesRefAttribute.class) instanceof BytesRefBuilderTermAttributeImpl; wasReset = true; } @@ -347,8 +350,9 @@ public final class ConcatenateGraphFilter extends TokenStream { * * @lucene.internal */ + @SuppressWarnings("unused") // do not warn/error on redundant interface public static final class BytesRefBuilderTermAttributeImpl extends AttributeImpl - implements BytesRefBuilderTermAttribute, TermToBytesRefAttribute { + implements BytesRefBuilderTermAttribute, TermToBytesRefAttribute /*required*/ { private final BytesRefBuilder bytes = new BytesRefBuilder(); private transient CharsRefBuilder charsRef; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java index 71f4e1a9c69..b0d7f9bb705 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java @@ -31,7 +31,6 @@ import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.TokenFilterFactory; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.util.ResourceLoader; -import org.apache.lucene.util.ResourceLoaderAware; /** * Factory for a {@link ProtectedTermFilter} @@ -82,8 +81,7 @@ import org.apache.lucene.util.ResourceLoaderAware; * @since 7.4.0 * @lucene.spi {@value #NAME} */ -public class ProtectedTermFilterFactory extends ConditionalTokenFilterFactory - implements ResourceLoaderAware { +public class ProtectedTermFilterFactory extends ConditionalTokenFilterFactory { public static final String NAME = "protectedTerm"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/FloatEncoder.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/FloatEncoder.java index b90e137c779..5cf3319aaf5 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/FloatEncoder.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/FloatEncoder.java @@ -23,7 +23,7 @@ import org.apache.lucene.util.BytesRef; * * @see org.apache.lucene.analysis.payloads.PayloadHelper#encodeFloat(float, byte[], int) */ -public class FloatEncoder extends AbstractEncoder implements PayloadEncoder { +public class FloatEncoder extends AbstractEncoder { @Override public BytesRef encode(char[] buffer, int offset, int length) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IdentityEncoder.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IdentityEncoder.java index 22dd4a186ba..96431dd1835 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IdentityEncoder.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IdentityEncoder.java @@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets; import org.apache.lucene.util.BytesRef; /** Does nothing other than convert the char array to a byte array using the specified encoding. */ -public class IdentityEncoder extends AbstractEncoder implements PayloadEncoder { +public class IdentityEncoder extends AbstractEncoder { protected Charset charset = StandardCharsets.UTF_8; public IdentityEncoder() {} diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IntegerEncoder.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IntegerEncoder.java index 01ac02640a3..476718fe9ee 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IntegerEncoder.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/IntegerEncoder.java @@ -24,7 +24,7 @@ import org.apache.lucene.util.BytesRef; * *

See {@link org.apache.lucene.analysis.payloads.PayloadHelper#encodeInt(int, byte[], int)}. */ -public class IntegerEncoder extends AbstractEncoder implements PayloadEncoder { +public class IntegerEncoder extends AbstractEncoder { @Override public BytesRef encode(char[] buffer, int offset, int length) { diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/tokenattributes/ScriptAttributeImpl.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/tokenattributes/ScriptAttributeImpl.java index d2a389bceae..263656fd0de 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/tokenattributes/ScriptAttributeImpl.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/tokenattributes/ScriptAttributeImpl.java @@ -25,7 +25,7 @@ import org.apache.lucene.util.AttributeReflector; * * @lucene.experimental */ -public class ScriptAttributeImpl extends AttributeImpl implements ScriptAttribute, Cloneable { +public class ScriptAttributeImpl extends AttributeImpl implements ScriptAttribute { private int code = UScript.COMMON; /** Initializes this attribute with UScript.COMMON */ diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/BaseFormAttributeImpl.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/BaseFormAttributeImpl.java index e1a6e43c022..845c318c214 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/BaseFormAttributeImpl.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/BaseFormAttributeImpl.java @@ -21,7 +21,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Attribute for {@link Token#getBaseForm()}. */ -public class BaseFormAttributeImpl extends AttributeImpl implements BaseFormAttribute, Cloneable { +public class BaseFormAttributeImpl extends AttributeImpl implements BaseFormAttribute { private Token token; @Override diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/InflectionAttributeImpl.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/InflectionAttributeImpl.java index 21df3e9a138..36a04dce089 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/InflectionAttributeImpl.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/InflectionAttributeImpl.java @@ -22,8 +22,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Attribute for Kuromoji inflection data. */ -public class InflectionAttributeImpl extends AttributeImpl - implements InflectionAttribute, Cloneable { +public class InflectionAttributeImpl extends AttributeImpl implements InflectionAttribute { private Token token; @Override diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/PartOfSpeechAttributeImpl.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/PartOfSpeechAttributeImpl.java index c2f54ffd952..464adbdf7ad 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/PartOfSpeechAttributeImpl.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/PartOfSpeechAttributeImpl.java @@ -22,8 +22,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Attribute for {@link Token#getPartOfSpeech()}. */ -public class PartOfSpeechAttributeImpl extends AttributeImpl - implements PartOfSpeechAttribute, Cloneable { +public class PartOfSpeechAttributeImpl extends AttributeImpl implements PartOfSpeechAttribute { private Token token; @Override diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/ReadingAttributeImpl.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/ReadingAttributeImpl.java index c71aa64ffe0..bada2421bed 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/ReadingAttributeImpl.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/tokenattributes/ReadingAttributeImpl.java @@ -22,7 +22,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Attribute for Kuromoji reading data */ -public class ReadingAttributeImpl extends AttributeImpl implements ReadingAttribute, Cloneable { +public class ReadingAttributeImpl extends AttributeImpl implements ReadingAttribute { private Token token; @Override diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java index 0c3ad9c2e73..a749045f0dd 100644 --- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java +++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java @@ -27,7 +27,7 @@ import org.apache.lucene.util.AttributeReflector; * @see MorphosyntacticTagsAttribute */ public class MorphosyntacticTagsAttributeImpl extends AttributeImpl - implements MorphosyntacticTagsAttribute, Cloneable { + implements MorphosyntacticTagsAttribute { /** Initializes this attribute with no tags */ public MorphosyntacticTagsAttributeImpl() {} diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java index a46b88859e3..a1b04cb7f05 100644 --- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java +++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java @@ -28,8 +28,7 @@ import org.apache.lucene.util.AttributeReflector; * * @lucene.experimental */ -public class PartOfSpeechAttributeImpl extends AttributeImpl - implements PartOfSpeechAttribute, Cloneable { +public class PartOfSpeechAttributeImpl extends AttributeImpl implements PartOfSpeechAttribute { private Token token; @Override diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/ReadingAttributeImpl.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/ReadingAttributeImpl.java index b6467a09f05..e3a6c0d9062 100644 --- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/ReadingAttributeImpl.java +++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/ReadingAttributeImpl.java @@ -25,7 +25,7 @@ import org.apache.lucene.util.AttributeReflector; * * @lucene.experimental */ -public class ReadingAttributeImpl extends AttributeImpl implements ReadingAttribute, Cloneable { +public class ReadingAttributeImpl extends AttributeImpl implements ReadingAttribute { private Token token; @Override diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/compressing/Lucene50CompressingTermVectorsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/compressing/Lucene50CompressingTermVectorsReader.java index 6d8a248042f..c2f975d0a71 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/compressing/Lucene50CompressingTermVectorsReader.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/compressing/Lucene50CompressingTermVectorsReader.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.backward_codecs.lucene50.compressing; -import java.io.Closeable; import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -58,8 +57,7 @@ import org.apache.lucene.util.packed.PackedInts; * * @lucene.experimental */ -public final class Lucene50CompressingTermVectorsReader extends TermVectorsReader - implements Closeable { +public final class Lucene50CompressingTermVectorsReader extends TermVectorsReader { // hard limit on the maximum number of documents per chunk static final int MAX_DOCUMENTS_PER_CHUNK = 128; diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsReader.java index 75ca01c9d79..f7550570cf6 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsReader.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsReader.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.backward_codecs.lucene60; -import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -32,7 +31,7 @@ import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.bkd.BKDReader; /** Reads point values previously written with Lucene60PointsWriter */ -public class Lucene60PointsReader extends PointsReader implements Closeable { +public class Lucene60PointsReader extends PointsReader { final IndexInput dataIn; final SegmentReadState readState; final Map readers = new HashMap<>(); diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesConsumer.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesConsumer.java index a8c1bad4cad..d1173b5b707 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesConsumer.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesConsumer.java @@ -20,7 +20,6 @@ import static org.apache.lucene.backward_codecs.lucene70.Lucene70DocValuesFormat import static org.apache.lucene.backward_codecs.lucene70.Lucene70DocValuesFormat.NUMERIC_BLOCK_SHIFT; import static org.apache.lucene.backward_codecs.lucene70.Lucene70DocValuesFormat.NUMERIC_BLOCK_SIZE; -import java.io.Closeable; // javadocs import java.io.IOException; import java.util.Arrays; import java.util.HashMap; @@ -54,7 +53,7 @@ import org.apache.lucene.util.packed.DirectMonotonicWriter; import org.apache.lucene.util.packed.DirectWriter; /** writer for {@link Lucene70DocValuesFormat} */ -final class Lucene70DocValuesConsumer extends DocValuesConsumer implements Closeable { +final class Lucene70DocValuesConsumer extends DocValuesConsumer { IndexOutput data, meta; final int maxDoc; diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesProducer.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesProducer.java index 2e2f20d2230..a52989dc68e 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesProducer.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene70/Lucene70DocValuesProducer.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.backward_codecs.lucene70; -import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -49,7 +48,7 @@ import org.apache.lucene.util.packed.DirectMonotonicReader; import org.apache.lucene.util.packed.DirectReader; /** reader for {@link Lucene70DocValuesFormat} */ -final class Lucene70DocValuesProducer extends DocValuesProducer implements Closeable { +final class Lucene70DocValuesProducer extends DocValuesProducer { private final Map numerics = new HashMap<>(); private final Map binaries = new HashMap<>(); private final Map sorted = new HashMap<>(); diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesConsumer.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesConsumer.java index bfb03352140..12d97c008eb 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesConsumer.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesConsumer.java @@ -62,7 +62,7 @@ import org.apache.lucene.util.packed.DirectMonotonicWriter; import org.apache.lucene.util.packed.DirectWriter; /** writer for {@link Lucene80DocValuesFormat} */ -final class Lucene80DocValuesConsumer extends DocValuesConsumer implements Closeable { +final class Lucene80DocValuesConsumer extends DocValuesConsumer { final Lucene80DocValuesFormat.Mode mode; IndexOutput data, meta; diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java index 67e69ee93d2..3bff879b057 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.backward_codecs.lucene80; -import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -52,7 +51,7 @@ import org.apache.lucene.util.packed.DirectMonotonicReader; import org.apache.lucene.util.packed.DirectReader; /** reader for {@link Lucene80DocValuesFormat} */ -final class Lucene80DocValuesProducer extends DocValuesProducer implements Closeable { +final class Lucene80DocValuesProducer extends DocValuesProducer { private final Map numerics = new HashMap<>(); private final Map binaries = new HashMap<>(); private final Map sorted = new HashMap<>(); diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsWriter.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsWriter.java index ea07ce58136..4dbfd3870a5 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsWriter.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene60/Lucene60PointsWriter.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.backward_codecs.lucene60; -import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +40,7 @@ import org.apache.lucene.util.bkd.BKDReader; import org.apache.lucene.util.bkd.BKDWriter; /** Writes dimensional values */ -public class Lucene60PointsWriter extends PointsWriter implements Closeable { +public class Lucene60PointsWriter extends PointsWriter { /** Output used to write the BKD tree data file */ protected final IndexOutput dataOut; diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java index c944af8233f..fefbc7b1954 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java @@ -36,7 +36,7 @@ import org.apache.lucene.search.spans.SpanTermQuery; * A QueryMaker that uses common and uncommon actual Wikipedia queries for searching the English * Wikipedia collection. 90 queries total. */ -public class EnwikiQueryMaker extends AbstractQueryMaker implements QueryMaker { +public class EnwikiQueryMaker extends AbstractQueryMaker { // common and a few uncommon queries from wikipedia search logs private static String[] STANDARD_QUERIES = { diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java index 2eb257a7129..283178e9d00 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java @@ -43,7 +43,7 @@ import org.apache.lucene.util.IOUtils; *

file.query.maker.file=c:/myqueries.txt
  * file.query.maker.default.field=body
*/ -public class FileBasedQueryMaker extends AbstractQueryMaker implements QueryMaker { +public class FileBasedQueryMaker extends AbstractQueryMaker { @Override protected Query[] prepareQueries() throws Exception { diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java index 795e3a66ac6..1f3216d85b8 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java @@ -34,7 +34,7 @@ import org.apache.lucene.search.spans.SpanTermQuery; * A QueryMaker that makes queries devised manually (by Grant Ingersoll) for searching in the * Reuters collection. */ -public class ReutersQueryMaker extends AbstractQueryMaker implements QueryMaker { +public class ReutersQueryMaker extends AbstractQueryMaker { private static String[] STANDARD_QUERIES = { // Start with some short queries diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java index c7036f556ca..ceaabcbcfe7 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java @@ -30,7 +30,7 @@ import org.apache.lucene.search.TermQuery; * A QueryMaker that makes queries for a collection created using {@link * org.apache.lucene.benchmark.byTask.feeds.SingleDocSource}. */ -public class SimpleQueryMaker extends AbstractQueryMaker implements QueryMaker { +public class SimpleQueryMaker extends AbstractQueryMaker { /** * Prepare the queries for this test. Extending classes can override this method for preparing diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java index fff2c569c46..3784f4113b6 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.codecs.blockterms; -import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -52,7 +51,7 @@ import org.apache.lucene.util.IOUtils; * * @lucene.experimental */ -public class BlockTermsWriter extends FieldsConsumer implements Closeable { +public class BlockTermsWriter extends FieldsConsumer { static final String CODEC_NAME = "BlockTermsWriter"; diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/BytesTermAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/BytesTermAttributeImpl.java index 8783bbfedf9..c9975534b47 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/BytesTermAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/BytesTermAttributeImpl.java @@ -26,8 +26,9 @@ import org.apache.lucene.util.BytesRef; * * @lucene.internal */ +@SuppressWarnings("unused") // do not warn/error on redundant interface public class BytesTermAttributeImpl extends AttributeImpl - implements BytesTermAttribute, TermToBytesRefAttribute { + implements BytesTermAttribute, TermToBytesRefAttribute /*required*/ { private BytesRef bytes; /** Initialize this attribute with no bytes. */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java index bae5c60968e..c494bda1ab2 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java @@ -26,7 +26,7 @@ import org.apache.lucene.util.BytesRefBuilder; /** Default implementation of {@link CharTermAttribute}. */ public class CharTermAttributeImpl extends AttributeImpl - implements CharTermAttribute, TermToBytesRefAttribute, Cloneable { + implements CharTermAttribute, TermToBytesRefAttribute { private static int MIN_BUFFER_SIZE = 10; private char[] termBuffer = new char[ArrayUtil.oversize(MIN_BUFFER_SIZE, Character.BYTES)]; diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttributeImpl.java index 9a1bdc37db1..9fe02aaf774 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/FlagsAttributeImpl.java @@ -20,7 +20,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link FlagsAttribute}. */ -public class FlagsAttributeImpl extends AttributeImpl implements FlagsAttribute, Cloneable { +public class FlagsAttributeImpl extends AttributeImpl implements FlagsAttribute { private int flags = 0; /** Initialize this attribute with no bits set */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttributeImpl.java index 8ddae001100..8e05ece82b3 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/OffsetAttributeImpl.java @@ -20,7 +20,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link OffsetAttribute}. */ -public class OffsetAttributeImpl extends AttributeImpl implements OffsetAttribute, Cloneable { +public class OffsetAttributeImpl extends AttributeImpl implements OffsetAttribute { private int startOffset; private int endOffset; diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java index da36ebd01f9..b17f0183313 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java @@ -21,7 +21,7 @@ import org.apache.lucene.util.AttributeReflector; import org.apache.lucene.util.BytesRef; /** Default implementation of {@link PayloadAttribute}. */ -public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttribute, Cloneable { +public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttribute { private BytesRef payload; /** Initialize this attribute with no payload. */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttributeImpl.java index 80ef0d42fbf..31ceca1a62f 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionIncrementAttributeImpl.java @@ -21,7 +21,7 @@ import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link PositionIncrementAttribute}. */ public class PositionIncrementAttributeImpl extends AttributeImpl - implements PositionIncrementAttribute, Cloneable { + implements PositionIncrementAttribute { private int positionIncrement = 1; /** Initialize this attribute with position increment of 1 */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionLengthAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionLengthAttributeImpl.java index 3a59faa60e0..b7dd308e0e1 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionLengthAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PositionLengthAttributeImpl.java @@ -20,8 +20,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link PositionLengthAttribute}. */ -public class PositionLengthAttributeImpl extends AttributeImpl - implements PositionLengthAttribute, Cloneable { +public class PositionLengthAttributeImpl extends AttributeImpl implements PositionLengthAttribute { private int positionLength = 1; /** Initializes this attribute with position length of 1. */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TermFrequencyAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TermFrequencyAttributeImpl.java index 4e8520f384f..f578e28aada 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TermFrequencyAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TermFrequencyAttributeImpl.java @@ -20,8 +20,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link TermFrequencyAttribute}. */ -public class TermFrequencyAttributeImpl extends AttributeImpl - implements TermFrequencyAttribute, Cloneable { +public class TermFrequencyAttributeImpl extends AttributeImpl implements TermFrequencyAttribute { private int termFrequency = 1; /** Initialize this attribute with term frequency of 1 */ diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java index dbe5e942e02..0f444044cdd 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java @@ -20,7 +20,7 @@ import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; /** Default implementation of {@link TypeAttribute}. */ -public class TypeAttributeImpl extends AttributeImpl implements TypeAttribute, Cloneable { +public class TypeAttributeImpl extends AttributeImpl implements TypeAttribute { private String type; /** Initialize this attribute with {@link TypeAttribute#DEFAULT_TYPE} */ diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsReader.java index affe4fed773..3b21a403e45 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsReader.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.codecs.lucene86; -import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -33,7 +32,7 @@ import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.bkd.BKDReader; /** Reads point values previously written with {@link Lucene86PointsWriter} */ -public class Lucene86PointsReader extends PointsReader implements Closeable { +public class Lucene86PointsReader extends PointsReader { final IndexInput indexIn, dataIn; final SegmentReadState readState; final Map readers = new HashMap<>(); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsWriter.java index 0fcf77df346..ba29bf87095 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsWriter.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene86/Lucene86PointsWriter.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.codecs.lucene86; -import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -39,7 +38,7 @@ import org.apache.lucene.util.bkd.BKDReader; import org.apache.lucene.util.bkd.BKDWriter; /** Writes dimensional values */ -public class Lucene86PointsWriter extends PointsWriter implements Closeable { +public class Lucene86PointsWriter extends PointsWriter { /** Outputs used to write the BKD tree data files. */ protected final IndexOutput metaOut, indexOut, dataOut; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumer.java index 80a5868e9ba..2e6389a3d94 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumer.java @@ -62,7 +62,7 @@ import org.apache.lucene.util.packed.DirectMonotonicWriter; import org.apache.lucene.util.packed.DirectWriter; /** writer for {@link Lucene90DocValuesFormat} */ -final class Lucene90DocValuesConsumer extends DocValuesConsumer implements Closeable { +final class Lucene90DocValuesConsumer extends DocValuesConsumer { final Lucene90DocValuesFormat.Mode mode; IndexOutput data, meta; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java index 0a2bb13be69..eaa4a456aa7 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.codecs.lucene90; -import java.io.Closeable; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -52,7 +51,7 @@ import org.apache.lucene.util.packed.DirectMonotonicReader; import org.apache.lucene.util.packed.DirectReader; /** reader for {@link Lucene90DocValuesFormat} */ -final class Lucene90DocValuesProducer extends DocValuesProducer implements Closeable { +final class Lucene90DocValuesProducer extends DocValuesProducer { private final Map numerics = new HashMap<>(); private final Map binaries = new HashMap<>(); private final Map sorted = new HashMap<>(); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java index 6d501eca930..7aca22b0d54 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java @@ -29,7 +29,6 @@ import static org.apache.lucene.codecs.lucene90.compressing.Lucene90CompressingT import static org.apache.lucene.codecs.lucene90.compressing.Lucene90CompressingTermVectorsWriter.VERSION_CURRENT; import static org.apache.lucene.codecs.lucene90.compressing.Lucene90CompressingTermVectorsWriter.VERSION_START; -import java.io.Closeable; import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -71,8 +70,7 @@ import org.apache.lucene.util.packed.PackedInts; * * @lucene.experimental */ -public final class Lucene90CompressingTermVectorsReader extends TermVectorsReader - implements Closeable { +public final class Lucene90CompressingTermVectorsReader extends TermVectorsReader { private final FieldInfos fieldInfos; final FieldsIndex indexReader; diff --git a/lucene/core/src/java/org/apache/lucene/store/IndexInput.java b/lucene/core/src/java/org/apache/lucene/store/IndexInput.java index 10f4a375f2c..3d3d90bd6ff 100644 --- a/lucene/core/src/java/org/apache/lucene/store/IndexInput.java +++ b/lucene/core/src/java/org/apache/lucene/store/IndexInput.java @@ -37,7 +37,7 @@ import java.io.IOException; * * @see Directory */ -public abstract class IndexInput extends DataInput implements Cloneable, Closeable { +public abstract class IndexInput extends DataInput implements Closeable { private final String resourceDescription; diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java b/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java index 1039d48757f..3a34c55b72b 100644 --- a/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java @@ -21,6 +21,10 @@ package org.apache.lucene.util; * *

Attributes are used to add data in a dynamic, yet type-safe way to a source of usually * streamed objects, e. g. a {@link org.apache.lucene.analysis.TokenStream}. + * + *

All implementations must list all implemented {@link Attribute} interfaces in their {@code + * implements} clause. {@code AttributeSource} reflectively identifies all attributes and makes them + * available to consumers like {@code TokenStream}s. */ public abstract class AttributeImpl implements Cloneable, Attribute { /** diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java index 7193ca16702..a59d0649192 100644 --- a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java +++ b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java @@ -181,6 +181,9 @@ public class AttributeSource { * retrieve the wanted attributes using {@link #getAttribute} after adding with this method and * cast to your class. The recommended way to use custom implementations is using an {@link * AttributeFactory}. + * + *

This method will only add the Attribute interfaces directly implemented by the class and its + * super classes. */ public final void addAttributeImpl(final AttributeImpl att) { final Class clazz = att.getClass(); diff --git a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java index 7b79ece2d9d..707ee76b197 100644 --- a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java +++ b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java @@ -28,7 +28,7 @@ import org.apache.lucene.search.DocIdSetIterator; * * @lucene.internal */ -public final class FixedBitSet extends BitSet implements Bits, Accountable { +public final class FixedBitSet extends BitSet { private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(FixedBitSet.class); diff --git a/lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java b/lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java index 2952ee2072c..2a1762a2675 100644 --- a/lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java +++ b/lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java @@ -33,7 +33,7 @@ import org.apache.lucene.search.DocIdSetIterator; * * @lucene.internal */ -public class SparseFixedBitSet extends BitSet implements Bits, Accountable { +public class SparseFixedBitSet extends BitSet { private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(SparseFixedBitSet.class); diff --git a/lucene/core/src/test/org/apache/lucene/analysis/tokenattributes/TestBytesRefAttImpl.java b/lucene/core/src/test/org/apache/lucene/analysis/tokenattributes/TestBytesRefAttImpl.java index 54f23e7189f..ebf20d8dc56 100644 --- a/lucene/core/src/test/org/apache/lucene/analysis/tokenattributes/TestBytesRefAttImpl.java +++ b/lucene/core/src/test/org/apache/lucene/analysis/tokenattributes/TestBytesRefAttImpl.java @@ -16,6 +16,7 @@ */ package org.apache.lucene.analysis.tokenattributes; +import java.util.stream.Stream; import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.LuceneTestCase; @@ -44,4 +45,11 @@ public class TestBytesRefAttImpl extends LuceneTestCase { assertEquals("Copied instance's hashcode must be equal", att.hashCode(), copy.hashCode()); return copy; } + + public void testLucene9856() { + assertTrue( + "BytesTermAttributeImpl must explicitly declare to implement TermToBytesRefAttribute", + Stream.of(BytesTermAttributeImpl.class.getInterfaces()) + .anyMatch(TermToBytesRefAttribute.class::equals)); + } } diff --git a/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java b/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java index df9ef10dc43..93ef7e87fc2 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java @@ -46,8 +46,7 @@ import org.apache.lucene.util.DocIdSetBuilder; * instantiate one of the {@link Facets} subclasses to do the facet counting. Use the {@code search} * utility methods to perform an "ordinary" search but also collect into a {@link Collector}. */ -// redundant 'implements Collector' to workaround javadocs bugs -public class FacetsCollector extends SimpleCollector implements Collector { +public class FacetsCollector extends SimpleCollector { private LeafReaderContext context; private Scorable scorer; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java index 9db8d04a6a9..f11477c13a9 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java @@ -34,7 +34,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; /** Assembles a QueryBuilder which uses only core Lucene Query objects */ -public class CoreParser implements QueryBuilder, SpanQueryBuilder { +public class CoreParser implements SpanQueryBuilder { protected String defaultField; protected Analyzer analyzer; diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java index 0ab2efb6574..d02a149b24a 100755 --- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java +++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java @@ -24,8 +24,8 @@ import java.io.InputStream; * * @lucene.experimental */ -public class GeoCompositeMembershipShape extends GeoBaseCompositeMembershipShape - implements GeoMembershipShape { +public class GeoCompositeMembershipShape + extends GeoBaseCompositeMembershipShape { /** Constructor. */ public GeoCompositeMembershipShape(PlanetModel planetModel) { diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoMembershipShape.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoMembershipShape.java index 9ee092d96c3..dfc04591a53 100755 --- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoMembershipShape.java +++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoMembershipShape.java @@ -21,4 +21,4 @@ package org.apache.lucene.spatial3d.geom; * * @lucene.experimental */ -public interface GeoMembershipShape extends GeoShape, GeoOutsideDistance, Membership {} +public interface GeoMembershipShape extends GeoShape, GeoOutsideDistance {} diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java index 4eaf4f51f68..8186fe36daa 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java @@ -97,8 +97,7 @@ import org.apache.lucene.util.fst.Util.TopResults; * * @lucene.experimental */ -// redundant 'implements Accountable' to workaround javadocs bugs -public class AnalyzingSuggester extends Lookup implements Accountable { +public class AnalyzingSuggester extends Lookup { /** * FST<Weight,Surface>: input is the analyzed form, with a null byte between terms weights diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java index 11c57a72709..4e5ff17c9ab 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java @@ -100,8 +100,7 @@ import org.apache.lucene.util.fst.Util.TopResults; * * @lucene.experimental */ -// redundant 'implements Accountable' to workaround javadocs bugs -public class FreeTextSuggester extends Lookup implements Accountable { +public class FreeTextSuggester extends Lookup { /** Codec name used in the header for the saved model. */ public static final String CODEC_NAME = "freetextsuggest"; diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java index fcf72b75e1f..59335f12322 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java @@ -68,7 +68,7 @@ import org.apache.lucene.util.fst.NoOutputs; * @see FSTCompletion * @lucene.experimental */ -public class FSTCompletionLookup extends Lookup implements Accountable { +public class FSTCompletionLookup extends Lookup { /** * An invalid bucket count if we're creating an object of this class from an existing FST. * diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java index 1b3661bd334..a9c3924e06d 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java @@ -57,8 +57,7 @@ import org.apache.lucene.util.fst.Util.TopResults; * * @lucene.experimental */ -// redundant 'implements Accountable' to workaround javadocs bugs -public class WFSTCompletionLookup extends Lookup implements Accountable { +public class WFSTCompletionLookup extends Lookup { /** FST, weights are encoded as costs: (Integer.MAX_VALUE-weight) */ // NOTE: like FSTSuggester, this is really a WFSA, if you want to diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java index 1cf3666739d..f94c68d42d2 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java @@ -25,7 +25,6 @@ import org.apache.lucene.search.suggest.Lookup; import org.apache.lucene.search.suggest.jaspell.JaspellTernarySearchTrie.TSTNode; import org.apache.lucene.store.DataInput; import org.apache.lucene.store.DataOutput; -import org.apache.lucene.util.Accountable; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; import org.apache.lucene.util.CharsRefBuilder; @@ -37,7 +36,7 @@ import org.apache.lucene.util.CharsRefBuilder; * @deprecated Migrate to one of the newer suggesters which are much more RAM efficient. */ @Deprecated -public class JaspellLookup extends Lookup implements Accountable { +public class JaspellLookup extends Lookup { JaspellTernarySearchTrie trie = new JaspellTernarySearchTrie(); private boolean usePrefix = true; private int editDistance = 2; diff --git a/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java index 0485bd39cb8..41fbd95e9dc 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java @@ -143,6 +143,18 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase { if (output.length > 0) { assertTrue("has no CharTermAttribute", ts.hasAttribute(CharTermAttribute.class)); termAtt = ts.getAttribute(CharTermAttribute.class); + + // every UTF-16 character-based TokenStream MUST provide a TermToBytesRefAttribute, + // implemented by same instance like the CharTermAttribute: + assertTrue("has no TermToBytesRefAttribute", ts.hasAttribute(TermToBytesRefAttribute.class)); + TermToBytesRefAttribute bytesAtt = ts.getAttribute(TermToBytesRefAttribute.class); + + // ConcatenateGraphFilter has some tricky logic violating this. We have an extra assert there: + if (!Objects.equals( + bytesAtt.getClass().getSimpleName(), "BytesRefBuilderTermAttributeImpl")) { + assertSame( + "TermToBytesRefAttribute must be implemented by same instance", termAtt, bytesAtt); + } } OffsetAttribute offsetAtt = null; diff --git a/lucene/test-framework/src/java/org/apache/lucene/analysis/CannedBinaryTokenStream.java b/lucene/test-framework/src/java/org/apache/lucene/analysis/CannedBinaryTokenStream.java index 8db3ac5cddf..9ec9eee1611 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/analysis/CannedBinaryTokenStream.java +++ b/lucene/test-framework/src/java/org/apache/lucene/analysis/CannedBinaryTokenStream.java @@ -20,6 +20,7 @@ import org.apache.lucene.analysis.tokenattributes.BytesTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute; +import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; import org.apache.lucene.util.BytesRef; /** TokenStream from a canned list of binary (BytesRef-based) tokens. */ @@ -57,6 +58,7 @@ public final class CannedBinaryTokenStream extends TokenStream { public CannedBinaryTokenStream(BinaryToken... tokens) { super(Token.TOKEN_ATTRIBUTE_FACTORY); this.tokens = tokens; + assert termAtt == getAttribute(TermToBytesRefAttribute.class); } @Override