Apache Solr open-source search software
SOLR-16269 clean up use of final keyword (#919)
Eric Pugh7efff2f23325
diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.javaindex 76e8be9329f..a71e71401f9 100644--- a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java@@ -567,8 +567,7 @@ public class DeleteReplicaTest extends SolrCloudTestCase {* same node. Instead tests should only assert that the number of watchers has decreased by 1 per* known replica removed)*/- private static final long countUnloadCoreOnDeletedWatchers(- final Set<DocCollectionWatcher> watchers) {+ private static long countUnloadCoreOnDeletedWatchers(final Set<DocCollectionWatcher> watchers) {return watchers.stream().filter(w -> w instanceof ZkController.UnloadCoreOnDeletedWatcher).count();diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.javaindex e3923e2812e..bb9a72bc068 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java@@ -352,7 +352,7 @@ public class TestTolerantUpdateProcessorRandomCloud extends SolrCloudTestCase {* Given a BitSet, returns a random bit that is currently false, or -1 if all bits are true. NOTE:* this method is not fair.*/- public static final int randomUnsetBit(Random r, BitSet bits, final int max) {+ public static int randomUnsetBit(Random r, BitSet bits, final int max) {// NOTE: don't forget, BitSet will grow automatically if not carefulif (bits.cardinality() == max + 1) {return -1;@@ -378,15 +378,14 @@ public class TestTolerantUpdateProcessorRandomCloud extends SolrCloudTestCase {}/** returns the numFound from a *:* query */- public static final long countDocs(SolrClient c) throws Exception {+ public static long countDocs(SolrClient c) throws Exception {return c.query(params("q", "*:*", "rows", "0")).getResults().getNumFound();}/*** uses a Cursor to iterate over every doc in the index, recording the 'id_i' value in a BitSet*/- private static final BitSet allDocs(final SolrClient c, final int maxDocIdExpected)- throws Exception {+ private static BitSet allDocs(final SolrClient c, final int maxDocIdExpected) throws Exception {BitSet docs = new BitSet(maxDocIdExpected + 1);String cursorMark = CURSOR_MARK_START;int docsOnThisPage = Integer.MAX_VALUE;diff --git a/solr/core/src/test/org/apache/solr/core/MockEventListener.java b/solr/core/src/test/org/apache/solr/core/MockEventListener.javaindex cfc1eb42839..67c0cce7433 100644--- a/solr/core/src/test/org/apache/solr/core/MockEventListener.java+++ b/solr/core/src/test/org/apache/solr/core/MockEventListener.java@@ -23,7 +23,7 @@ public class MockEventListener implements SolrEventListener {static final AtomicInteger createCounter = new AtomicInteger(0);- public static final int getCreateCount() {+ public static int getCreateCount() {return createCounter.intValue();}diff --git a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java b/solr/core/src/test/org/apache/solr/core/TestLazyCores.javaindex 3ad37aa9cc2..81b527bdc96 100644--- a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java+++ b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java@@ -898,7 +898,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {return new LocalSolrQueryRequest(core, params(paramPairs));}- private static final String makePath(String... args) {+ private static String makePath(String... args) {return String.join(File.separator, args);}diff --git a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.javaindex 7285a25d3b4..6cc8d8b5b6a 100644--- a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java+++ b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java@@ -1063,7 +1063,7 @@ public class TestBlockCollapse extends SolrTestCaseJ4 {}/** returns a (new) list of the block based documents used in our test methods */- protected static final List<SolrInputDocument> makeBlockDocs() {+ protected static List<SolrInputDocument> makeBlockDocs() {// NOTE: block_i and block_s1 will contain identical content so these need to be "numbers"...// The specific numbers shouldn't matter (and we explicitly test '0' to confirm legacy// bug/behaviordiff --git a/solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java b/solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.javaindex 4cb9584050c..52c70a03e40 100644--- a/solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java+++ b/solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java@@ -1131,15 +1131,15 @@ public class RangeFacetCloudTest extends SolrCloudTestCase {}}- private static final ModelRange emptyVals() {+ private static ModelRange emptyVals() {return new ModelRange(-1, -100);}- private static final ModelRange modelVals(int value) {+ private static ModelRange modelVals(int value) {return modelVals(value, value);}- private static final ModelRange modelVals(int lower, int upper) {+ private static ModelRange modelVals(int lower, int upper) {assertTrue(upper + " < " + lower, lower <= upper);assertTrue("negative lower", 0 <= lower);assertTrue("negative upper", 0 <= upper);@@ -1147,7 +1147,7 @@ public class RangeFacetCloudTest extends SolrCloudTestCase {}/** randomized helper */- private static final Integer pickSubFacetLimit(final boolean doSubFacet) {+ private static Integer pickSubFacetLimit(final boolean doSubFacet) {if (!doSubFacet) {return null;}@@ -1155,7 +1155,7 @@ public class RangeFacetCloudTest extends SolrCloudTestCase {return (result <= 0) ? -1 : result;}/** randomized helper */- private static final CharSequence makeSubFacet(final Integer subFacetLimit) {+ private static CharSequence makeSubFacet(final Integer subFacetLimit) {if (null == subFacetLimit) {return "";}@@ -1182,7 +1182,7 @@ public class RangeFacetCloudTest extends SolrCloudTestCase {* @see #formatFacetRangeOther* @see #OTHERS*/- private static final List<EnumSet<FacetRangeOther>> buildListOfFacetRangeOtherOptions() {+ private static List<EnumSet<FacetRangeOther>> buildListOfFacetRangeOtherOptions() {assertEquals("If someone adds to FacetRangeOther this method (and bulk of test) needs updated",5,@@ -1206,7 +1206,7 @@ public class RangeFacetCloudTest extends SolrCloudTestCase {* @see #assertBeforeAfterBetween* @see #buildListOfFacetRangeOtherOptions*/- private static final String formatFacetRangeOther(EnumSet<FacetRangeOther> other) {+ private static String formatFacetRangeOther(EnumSet<FacetRangeOther> other) {if (other.contains(FacetRangeOther.NONE) && random().nextBoolean()) {return ""; // sometimes don't output a param at all when we're dealing with the default NONE}diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.javaindex 619164100b9..02463f081dd 100644--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java@@ -5076,12 +5076,12 @@ public class TestJsonFacets extends SolrTestCaseHS {}/** atomically resets the actual AtomicLong value matches the expected and resets it to 0 */- private static final void assertEqualsAndReset(String msg, long expected, AtomicLong actual) {+ private static void assertEqualsAndReset(String msg, long expected, AtomicLong actual) {final long current = actual.getAndSet(0);assertEquals(msg, expected, current);}/** atomically resets the actual AtomicLong value matches the expected and resets it to 0 */- private static final void assertEqualsAndReset(long expected, AtomicLong actual) {+ private static void assertEqualsAndReset(long expected, AtomicLong actual) {final long current = actual.getAndSet(0);assertEquals(expected, current);}diff --git a/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java b/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.javaindex 7aaf7e9d57a..5e72d79f821 100644--- a/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java+++ b/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java@@ -1073,7 +1073,7 @@ public class TestMinMaxOnMultiValuedField extends SolrTestCaseJ4 {* other documents in the result.* </ul>*/- private static final List<SolrInputDocument> buildMultiValueSortedDocuments(+ private static List<SolrInputDocument> buildMultiValueSortedDocuments(final String f, final List<Object> vals) {// build a list of docIds that we can shuffle (so the id order doesn't match the value order)List<Integer> ids = new ArrayList<>(vals.size());diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.javaindex 17c1506ea04..6ca4908ccb9 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java@@ -1040,7 +1040,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {}/** pick a random type of RandomUpdate */- public static final RandomUpdate pick(Random r) {+ public static RandomUpdate pick(Random r) {final int target = TestUtil.nextInt(r, 1, 100);int cumulative_odds = 0;for (RandomUpdate candidate : RandomUpdate.values()) {