From 1630ed4bd8431c225b90b7f581c4757fc92d8d3b Mon Sep 17 00:00:00 2001
From: Shubham Chaudhary <36742242+shubhamvishu@users.noreply.github.com>
Date: Mon, 11 Dec 2023 23:47:47 +0530
Subject: [PATCH] Remove some redundant modifiers from code (#12880)
---
.../compound/TestCompoundWordTokenFilter.java | 2 +-
.../org/apache/lucene/index/IndexReader.java | 4 ++--
.../apache/lucene/index/IndexableField.java | 18 +++++++++---------
.../apache/lucene/index/TwoPhaseCommit.java | 6 +++---
.../search/similarities/LMSimilarity.java | 4 ++--
.../apache/lucene/store/ByteBufferGuard.java | 2 +-
.../org/apache/lucene/store/MMapDirectory.java | 2 +-
.../apache/lucene/store/RandomAccessInput.java | 10 +++++-----
.../java/org/apache/lucene/util/ArrayUtil.java | 2 +-
.../apache/lucene/util/AttributeReflector.java | 2 +-
.../apache/lucene/util/ClassLoaderUtils.java | 2 +-
.../org/apache/lucene/util/NamedSPILoader.java | 2 +-
.../org/apache/lucene/util/ResourceLoader.java | 6 +++---
.../org/apache/lucene/util/RollingBuffer.java | 4 ++--
.../org/apache/lucene/util/Unwrappable.java | 2 +-
.../util/automaton/AutomatonProvider.java | 2 +-
.../org/apache/lucene/util/bkd/BKDUtil.java | 2 +-
.../apache/lucene/util/packed/PackedInts.java | 8 ++++----
.../org/apache/lucene/search/TestBoolean2.java | 6 +++---
.../search/join/DocValuesTermsCollector.java | 2 +-
.../core/builders/TestQueryTreeBuilder.java | 2 +-
.../prefix/tree/NumberRangePrefixTree.java | 8 ++++----
.../spatial3d/geom/GeoComplexPolygon.java | 10 +++++-----
.../search/suggest/SuggestRebuildTestUtil.java | 4 ++--
.../analysis/BaseTokenStreamTestCase.java | 4 ++--
.../tests/util/TestRuleIgnoreTestSuites.java | 2 +-
.../tests/util/TestRuleLimitSysouts.java | 2 +-
27 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
index 446f25d8d1d..1e5ca1417c6 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
@@ -528,7 +528,7 @@ public class TestCompoundWordTokenFilter extends BaseTokenStreamTestCase {
assertTokenStreamContents(tf8, new String[] {"fußball"});
}
- public static interface MockRetainAttribute extends Attribute {
+ public interface MockRetainAttribute extends Attribute {
void setRetain(boolean attr);
boolean getRetain();
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java
index 0ed2d1e71b6..973f872f23f 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java
@@ -112,7 +112,7 @@ public abstract sealed class IndexReader implements Closeable permits CompositeR
*
* @lucene.experimental
*/
- public static interface CacheHelper {
+ public interface CacheHelper {
/**
* Get a key that the resource can be cached on. The given entry can be compared using identity,
@@ -139,7 +139,7 @@ public abstract sealed class IndexReader implements Closeable permits CompositeR
* @lucene.experimental
*/
@FunctionalInterface
- public static interface ClosedListener {
+ public interface ClosedListener {
/**
* Invoked when the resource (segment core, or index reader) that is being cached on is closed.
*/
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexableField.java b/lucene/core/src/java/org/apache/lucene/index/IndexableField.java
index 7293580df82..a929e83c9cc 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexableField.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexableField.java
@@ -34,10 +34,10 @@ import org.apache.lucene.util.BytesRef;
public interface IndexableField {
/** Field name */
- public String name();
+ String name();
/** {@link IndexableFieldType} describing the properties of this field. */
- public IndexableFieldType fieldType();
+ IndexableFieldType fieldType();
/**
* Creates the TokenStream used for indexing this field. If appropriate, implementations should
@@ -52,13 +52,13 @@ public interface IndexableField {
* @return TokenStream value for indexing the document. Should always return a non-null value if
* the field is to be indexed
*/
- public TokenStream tokenStream(Analyzer analyzer, TokenStream reuse);
+ TokenStream tokenStream(Analyzer analyzer, TokenStream reuse);
/** Non-null if this field has a binary value */
- public BytesRef binaryValue();
+ BytesRef binaryValue();
/** Non-null if this field has a string value */
- public String stringValue();
+ String stringValue();
/** Non-null if this field has a string value */
default CharSequence getCharSequenceValue() {
@@ -66,20 +66,20 @@ public interface IndexableField {
}
/** Non-null if this field has a Reader value */
- public Reader readerValue();
+ Reader readerValue();
/** Non-null if this field has a numeric value */
- public Number numericValue();
+ Number numericValue();
/**
* Stored value. This method is called to populate stored fields and must return a non-null value
* if the field stored.
*/
- public StoredValue storedValue();
+ StoredValue storedValue();
/**
* Describes how this field should be inverted. This must return a non-null value if the field
* indexes terms and postings.
*/
- public InvertableType invertableType();
+ InvertableType invertableType();
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommit.java b/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommit.java
index 6584ac568fc..a0694c50915 100644
--- a/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommit.java
+++ b/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommit.java
@@ -31,19 +31,19 @@ public interface TwoPhaseCommit {
* method, but avoid actual committing changes. If the 2-phase commit fails, {@link #rollback()}
* is called to discard all changes since last successful commit.
*/
- public long prepareCommit() throws IOException;
+ long prepareCommit() throws IOException;
/**
* The second phase of a 2-phase commit. Implementations should ideally do very little work in
* this method (following {@link #prepareCommit()}, and after it returns, the caller can assume
* that the changes were successfully committed to the underlying storage.
*/
- public long commit() throws IOException;
+ long commit() throws IOException;
/**
* Discards any changes that have occurred since the last commit. In a 2-phase commit algorithm,
* where one of the objects failed to {@link #commit()} or {@link #prepareCommit()}, this method
* is used to roll all other objects back to their previous state.
*/
- public void rollback() throws IOException;
+ void rollback() throws IOException;
}
diff --git a/lucene/core/src/java/org/apache/lucene/search/similarities/LMSimilarity.java b/lucene/core/src/java/org/apache/lucene/search/similarities/LMSimilarity.java
index 1ac50a30786..e1536db268f 100644
--- a/lucene/core/src/java/org/apache/lucene/search/similarities/LMSimilarity.java
+++ b/lucene/core/src/java/org/apache/lucene/search/similarities/LMSimilarity.java
@@ -121,12 +121,12 @@ public abstract class LMSimilarity extends SimilarityBase {
}
/** A strategy for computing the collection language model. */
- public static interface CollectionModel {
+ public interface CollectionModel {
/**
* Computes the probability {@code p(w|C)} according to the language model strategy for the
* current term.
*/
- public double computeProbability(BasicStats stats);
+ double computeProbability(BasicStats stats);
/** The name of the collection model strategy. */
public String getName();
diff --git a/lucene/core/src/java/org/apache/lucene/store/ByteBufferGuard.java b/lucene/core/src/java/org/apache/lucene/store/ByteBufferGuard.java
index 82f9e6fa997..da5db6586e2 100644
--- a/lucene/core/src/java/org/apache/lucene/store/ByteBufferGuard.java
+++ b/lucene/core/src/java/org/apache/lucene/store/ByteBufferGuard.java
@@ -39,7 +39,7 @@ final class ByteBufferGuard {
* this to allow unmapping of bytebuffers with private Java APIs.
*/
@FunctionalInterface
- static interface BufferCleaner {
+ interface BufferCleaner {
void freeBuffer(String resourceDescription, ByteBuffer b) throws IOException;
}
diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
index c9cddb4a308..af675a786fb 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
@@ -264,7 +264,7 @@ public class MMapDirectory extends FSDirectory {
*/
public static final String UNMAP_NOT_SUPPORTED_REASON;
- static interface MMapIndexInputProvider {
+ interface MMapIndexInputProvider {
IndexInput openInput(Path path, IOContext context, int chunkSizePower, boolean preload)
throws IOException;
diff --git a/lucene/core/src/java/org/apache/lucene/store/RandomAccessInput.java b/lucene/core/src/java/org/apache/lucene/store/RandomAccessInput.java
index cdeae8dc1fb..92c7f77307a 100644
--- a/lucene/core/src/java/org/apache/lucene/store/RandomAccessInput.java
+++ b/lucene/core/src/java/org/apache/lucene/store/RandomAccessInput.java
@@ -26,14 +26,14 @@ import org.apache.lucene.util.BitUtil; // javadocs
public interface RandomAccessInput {
/** The number of bytes in the file. */
- public long length();
+ long length();
/**
* Reads a byte at the given position in the file
*
* @see DataInput#readByte
*/
- public byte readByte(long pos) throws IOException;
+ byte readByte(long pos) throws IOException;
/**
* Reads a specified number of bytes starting at a given position into an array at the specified
@@ -53,7 +53,7 @@ public interface RandomAccessInput {
* @see DataInput#readShort
* @see BitUtil#VH_LE_SHORT
*/
- public short readShort(long pos) throws IOException;
+ short readShort(long pos) throws IOException;
/**
* Reads an integer (LE byte order) at the given position in the file
@@ -61,7 +61,7 @@ public interface RandomAccessInput {
* @see DataInput#readInt
* @see BitUtil#VH_LE_INT
*/
- public int readInt(long pos) throws IOException;
+ int readInt(long pos) throws IOException;
/**
* Reads a long (LE byte order) at the given position in the file
@@ -69,5 +69,5 @@ public interface RandomAccessInput {
* @see DataInput#readLong
* @see BitUtil#VH_LE_LONG
*/
- public long readLong(long pos) throws IOException;
+ long readLong(long pos) throws IOException;
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java b/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java
index 8d43cb958dc..629e289ef4d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java
@@ -714,7 +714,7 @@ public final class ArrayUtil {
/** Comparator for a fixed number of bytes. */
@FunctionalInterface
- public static interface ByteArrayComparator {
+ public interface ByteArrayComparator {
/**
* Compare bytes starting from the given offsets. The return value has the same contract as
diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeReflector.java b/lucene/core/src/java/org/apache/lucene/util/AttributeReflector.java
index 9207d6d3013..4835234d732 100644
--- a/lucene/core/src/java/org/apache/lucene/util/AttributeReflector.java
+++ b/lucene/core/src/java/org/apache/lucene/util/AttributeReflector.java
@@ -30,5 +30,5 @@ public interface AttributeReflector {
* method once using {@code org.apache.lucene.analysis.tokenattributes.CharTermAttribute.class} as
* attribute class, {@code "term"} as key and the actual value as a String.
*/
- public void reflect(Class extends Attribute> attClass, String key, Object value);
+ void reflect(Class extends Attribute> attClass, String key, Object value);
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java b/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
index c73949cef7c..78938e81238 100644
--- a/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
+++ b/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
@@ -32,7 +32,7 @@ public interface ClassLoaderUtils {
* returned (this is fine, because if we get a {@code SecurityException} it is for sure no
* parent).
*/
- public static boolean isParentClassLoader(final ClassLoader parent, final ClassLoader child) {
+ static boolean isParentClassLoader(final ClassLoader parent, final ClassLoader child) {
try {
ClassLoader cl = child;
while (cl != null) {
diff --git a/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java b/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java
index 62055aac3c7..9d0620c8a64 100644
--- a/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java
+++ b/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java
@@ -127,7 +127,7 @@ public final class NamedSPILoader implements
*
*
Names must be all ascii alphanumeric, and less than 128 characters in length.
*/
- public static interface NamedSPI {
+ public interface NamedSPI {
String getName();
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/ResourceLoader.java b/lucene/core/src/java/org/apache/lucene/util/ResourceLoader.java
index 7955893b25d..8f8a3333bcd 100644
--- a/lucene/core/src/java/org/apache/lucene/util/ResourceLoader.java
+++ b/lucene/core/src/java/org/apache/lucene/util/ResourceLoader.java
@@ -23,14 +23,14 @@ import java.io.InputStream;
public interface ResourceLoader {
/** Opens a named resource */
- public InputStream openResource(String resource) throws IOException;
+ InputStream openResource(String resource) throws IOException;
/** Finds class of the name and expected type */
- public