You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2020/06/12 11:25:46 UTC

[lucene-solr] branch master updated: LUCENE-9394: fix and suppress warnings (#1563)

This is an automated email from the ASF dual-hosted git repository.

sokolov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 26075fc  LUCENE-9394: fix and suppress warnings (#1563)
26075fc is described below

commit 26075fc1dc06766a9d2af8bd5dd14243c0463a6b
Author: Michael Sokolov <so...@falutin.net>
AuthorDate: Fri Jun 12 07:25:31 2020 -0400

    LUCENE-9394: fix and suppress warnings (#1563)
    
    * LUCENE-9394: fix and suppress warnings in lucene/*
    * Change type of ValuesSource context from raw Map to Map<Object, Object>
---
 .../ConcatenateGraphFilterFactory.java             |   4 +-
 .../FixBrokenOffsetsFilterFactory.java             |   1 +
 .../miscellaneous/WordDelimiterFilterFactory.java  |  19 +-
 .../lucene/analysis/core/TestBugInSomething.java   |   1 +
 .../lucene/analysis/core/TestRandomChains.java     |   4 +-
 .../lucene/analysis/custom/TestCustomAnalyzer.java |  13 +-
 .../miscellaneous/TestConcatenateGraphFilter.java  |   3 +
 .../TestConcatenateGraphFilterFactory.java         |   3 +-
 .../miscellaneous/TestFixBrokenOffsetsFilter.java  |   1 +
 .../TestLimitTokenPositionFilter.java              |   1 +
 .../TestRemoveDuplicatesTokenFilter.java           |   4 +-
 .../miscellaneous/TestWordDelimiterFilter.java     |  26 +--
 .../analysis/ngram/EdgeNGramTokenizerTest.java     |   2 +-
 .../lucene/analysis/ngram/NGramTokenizerTest.java  |   2 +-
 .../analysis/synonym/TestSolrSynonymParser.java    |   1 +
 .../analysis/synonym/TestSynonymFilterFactory.java |   1 +
 .../analysis/synonym/TestSynonymMapFilter.java     |   1 +
 .../analysis/synonym/TestWordnetSynonymParser.java |   3 +-
 .../util/TestFilesystemResourceLoader.java         |   5 +-
 .../lucene/analysis/icu/ICUTransformFilter.java    |   1 +
 .../document/DocumentClassificationTestBase.java   |   2 +-
 .../apache/lucene/util/fst/PositiveIntOutputs.java |   1 +
 .../lucene/util/packed/Packed64SingleBlock.java    |   3 +
 .../apache/lucene/analysis/TestCharArraySet.java   |   8 +-
 .../org/apache/lucene/document/TestDocument.java   |  12 +-
 .../lucene/search/TestMultiTermConstantScore.java  |   3 +-
 .../org/apache/lucene/search/TestSearchAfter.java  |   2 +-
 .../test/org/apache/lucene/util/TestCharsRef.java  |   2 +
 .../test/org/apache/lucene/util/TestVersion.java   |   1 +
 .../test/org/apache/lucene/util/fst/Test2BFST.java |   4 +-
 .../test/org/apache/lucene/util/fst/TestFSTs.java  |  20 +-
 .../apache/lucene/util/packed/TestPackedInts.java  |   4 +-
 .../org/apache/lucene/facet/DrillSideways.java     |   3 +-
 .../lucene/search/grouping/GroupingSearch.java     |   2 +-
 .../search/grouping/ValueSourceGroupSelector.java  |   4 +-
 .../search/grouping/BaseGroupSelectorTestCase.java |   2 +-
 .../lucene/search/grouping/TestGrouping.java       |   2 +
 .../search/join/ToParentBlockJoinSortField.java    |  12 +-
 .../lucene/search/join/TestBlockJoinSelector.java  |   9 +-
 .../lucene/util/fst/UpToTwoPositiveIntOutputs.java |   3 +-
 .../similarity/TestLegacyBM25Similarity.java       |   1 +
 .../lucene/queries/function/FunctionQuery.java     |   2 +-
 .../queries/function/FunctionRangeQuery.java       |   3 +-
 .../lucene/queries/function/ValueSource.java       |  28 +--
 .../function/valuesource/BytesRefFieldSource.java  |   2 +-
 .../valuesource/ComparisonBoolFunction.java        |   4 +-
 .../function/valuesource/ConstValueSource.java     |   2 +-
 .../queries/function/valuesource/DefFunction.java  |   2 +-
 .../function/valuesource/DocFreqValueSource.java   |   6 +-
 .../valuesource/DoubleConstValueSource.java        |   2 +-
 .../function/valuesource/DoubleFieldSource.java    |   4 +-
 .../function/valuesource/DualFloatFunction.java    |   4 +-
 .../function/valuesource/EnumFieldSource.java      |   2 +-
 .../function/valuesource/FloatFieldSource.java     |   4 +-
 .../function/valuesource/IDFValueSource.java       |   2 +-
 .../queries/function/valuesource/IfFunction.java   |   4 +-
 .../function/valuesource/IntFieldSource.java       |   4 +-
 .../valuesource/JoinDocFreqValueSource.java        |   2 +-
 .../function/valuesource/LinearFloatFunction.java  |   4 +-
 .../function/valuesource/LiteralValueSource.java   |   2 +-
 .../function/valuesource/LongFieldSource.java      |   4 +-
 .../function/valuesource/MaxDocValueSource.java    |   6 +-
 .../function/valuesource/MultiBoolFunction.java    |   4 +-
 .../function/valuesource/MultiFloatFunction.java   |   4 +-
 .../function/valuesource/MultiFunction.java        |   4 +-
 .../valuesource/MultiValuedDoubleFieldSource.java  |   2 +-
 .../valuesource/MultiValuedFloatFieldSource.java   |   2 +-
 .../valuesource/MultiValuedIntFieldSource.java     |   2 +-
 .../valuesource/MultiValuedLongFieldSource.java    |   2 +-
 .../function/valuesource/NormValueSource.java      |   4 +-
 .../function/valuesource/NumDocsValueSource.java   |   2 +-
 .../function/valuesource/QueryValueSource.java     |   8 +-
 .../valuesource/RangeMapFloatFunction.java         |   4 +-
 .../valuesource/ReciprocalFloatFunction.java       |   4 +-
 .../function/valuesource/ScaleFloatFunction.java   |   6 +-
 .../function/valuesource/SimpleBoolFunction.java   |   4 +-
 .../function/valuesource/SimpleFloatFunction.java  |   2 +-
 .../function/valuesource/SingleFunction.java       |   2 +-
 .../function/valuesource/SortedSetFieldSource.java |   2 +-
 .../valuesource/SumTotalTermFreqValueSource.java   |   4 +-
 .../function/valuesource/TFValueSource.java        |   2 +-
 .../function/valuesource/TermFreqValueSource.java  |   2 +-
 .../valuesource/TotalTermFreqValueSource.java      |   4 +-
 .../function/valuesource/VectorValueSource.java    |   4 +-
 .../lucene/queries/intervals/IntervalMatches.java  |   1 +
 .../lucene/queries/function/TestValueSources.java  |  10 +-
 .../apache/lucene/replicator/nrt/SimpleServer.java |   1 +
 .../apache/lucene/search/PhraseWildcardQuery.java  |   2 +-
 .../org/apache/lucene/spatial/SpatialStrategy.java |   2 +-
 .../lucene/spatial/bbox/BBoxValueSource.java       |   2 +-
 .../lucene/spatial/prefix/HeatmapFacetCounter.java |   4 +-
 .../spatial/prefix/WithinPrefixTreeQuery.java      |   6 +-
 .../spatial/prefix/tree/PackedQuadPrefixTree.java  |   8 +-
 .../lucene/spatial/prefix/tree/QuadPrefixTree.java |  10 +-
 .../spatial/spatial4j/Geo3dShapeFactory.java       |   2 +
 .../lucene/spatial/DistanceStrategyTest.java       |  14 +-
 .../org/apache/lucene/spatial/PortedSolr3Test.java |  70 ++++---
 .../lucene/spatial/QueryEqualsHashCodeTest.java    |   4 +-
 .../org/apache/lucene/spatial/SpatialExample.java  |  10 +-
 .../org/apache/lucene/spatial/SpatialTestCase.java |   7 +-
 .../lucene/spatial/bbox/TestBBoxStrategy.java      |  32 +--
 .../lucene/spatial/prefix/DateNRStrategyTest.java  |   2 +-
 .../spatial/prefix/HeatmapFacetCounterTest.java    |  32 +--
 .../lucene/spatial/prefix/JtsPolygonTest.java      |   6 +-
 .../spatial/prefix/NumberRangeFacetsTest.java      |  11 +-
 .../prefix/RandomSpatialOpStrategyTestCase.java    |   3 +-
 .../prefix/TestRecursivePrefixTreeStrategy.java    |   6 +-
 .../Geo3dShapeSphereModelRectRelationTest.java     |   2 +-
 .../spatial/spatial4j/RandomizedShapeTestCase.java | 233 ---------------------
 .../search/spell/LuceneLevenshteinDistance.java    |  24 ++-
 .../search/suggest/jaspell/JaspellLookup.java      |   4 +-
 .../search/spell/TestWordBreakSpellChecker.java    |   3 +-
 .../lucene/search/suggest/LookupBenchmarkTest.java |   2 +-
 .../lucene/search/suggest/PersistenceTest.java     |   3 +-
 .../java/org/apache/lucene/search/CheckHits.java   |  75 ++++---
 .../java/org/apache/lucene/search/QueryUtils.java  |  26 +--
 .../java/org/apache/lucene/util/fst/FSTTester.java |   1 +
 .../lucene/search/TestBaseExplanationTestCase.java |  12 +-
 .../util/TestExceptionInBeforeClassHooks.java      |   3 +-
 .../org/apache/solr/search/QueryEqualityTest.java  |   7 +-
 120 files changed, 427 insertions(+), 576 deletions(-)

diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java
index f01e724..37a4534 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java
@@ -65,7 +65,9 @@ public class ConcatenateGraphFilterFactory extends TokenFilterFactory {
   public ConcatenateGraphFilterFactory(Map<String, String> args) {
     super(args);
     Version luceneMatchVersion = getLuceneMatchVersion();
-    if (luceneMatchVersion.onOrAfter(Version.LUCENE_8_4_0)) {
+    @SuppressWarnings("deprecation")
+    Version LUCENE_8_4_0 = Version.LUCENE_8_4_0;
+    if (luceneMatchVersion.onOrAfter(LUCENE_8_4_0)) {
       tokenSeparator = getCharacter(args, "tokenSeparator", ConcatenateGraphFilter.DEFAULT_TOKEN_SEPARATOR);
     } else {
       boolean preserveSep = getBoolean(args, "preserveSep", ConcatenateGraphFilter.DEFAULT_PRESERVE_SEP);
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java
index 1d1ece7..b362b83 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java
@@ -27,6 +27,7 @@ import org.apache.lucene.analysis.util.TokenFilterFactory;
  * @since 7.0.0
  * @lucene.spi {@value #NAME}
  */
+@Deprecated
 public class FixBrokenOffsetsFilterFactory extends TokenFilterFactory {
 
   /** SPI name */
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java
index 5c3e07f..6228bf4 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java
@@ -33,8 +33,6 @@ import org.apache.lucene.analysis.util.ResourceLoaderAware;
 import org.apache.lucene.analysis.util.TokenFilterFactory;
 import org.apache.lucene.search.PhraseQuery;
 
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.*;
-
 /**
  * Factory for {@link WordDelimiterFilter}.
  * <pre class="prettyprint">
@@ -59,6 +57,23 @@ import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.*;
 @Deprecated
 public class WordDelimiterFilterFactory extends TokenFilterFactory implements ResourceLoaderAware {
 
+  private static final int CATENATE_ALL = WordDelimiterFilter.CATENATE_ALL;
+  private static final int CATENATE_NUMBERS = WordDelimiterFilter.CATENATE_NUMBERS;
+  private static final int CATENATE_WORDS = WordDelimiterFilter.CATENATE_WORDS;
+  private static final int GENERATE_NUMBER_PARTS = WordDelimiterFilter.GENERATE_NUMBER_PARTS;
+  private static final int GENERATE_WORD_PARTS = WordDelimiterFilter.GENERATE_WORD_PARTS;
+  private static final int PRESERVE_ORIGINAL = WordDelimiterFilter.PRESERVE_ORIGINAL;
+  private static final int SPLIT_ON_CASE_CHANGE = WordDelimiterFilter.SPLIT_ON_CASE_CHANGE;
+  private static final int SPLIT_ON_NUMERICS = WordDelimiterFilter.SPLIT_ON_NUMERICS;
+  private static final int STEM_ENGLISH_POSSESSIVE = WordDelimiterFilter.STEM_ENGLISH_POSSESSIVE;
+  private static final int ALPHA = WordDelimiterFilter.ALPHA;
+  private static final int ALPHANUM = WordDelimiterFilter.ALPHANUM;
+  private static final int DIGIT = WordDelimiterFilter.DIGIT;
+  private static final int LOWER = WordDelimiterFilter.LOWER;
+  private static final int SUBWORD_DELIM = WordDelimiterFilter.SUBWORD_DELIM;
+  private static final int UPPER = WordDelimiterFilter.UPPER;
+
+
   /** SPI name */
   public static final String NAME = "wordDelimiter";
 
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestBugInSomething.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestBugInSomething.java
index cb9b5096..315d8e1 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestBugInSomething.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestBugInSomething.java
@@ -256,6 +256,7 @@ public class TestBugInSomething extends BaseTokenStreamTestCase {
         -24, 106, -16, 126, 115, -105, 97, 65, -33, 57, 44, -1, 123, -68, 100, 13, -41, -64, 
         -119, 0, 92, 94, -36, 53, -9, -102, -18, 90, 94, -26, 31, 71, -20
     };
+    @SuppressWarnings("deprecation")
     Analyzer a = new Analyzer() {
       @Override
       protected TokenStreamComponents createComponents(String fieldName) {
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
index f1ac442..3c610d4 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestRandomChains.java
@@ -142,7 +142,9 @@ public class TestRandomChains extends BaseTokenStreamTestCase {
   }
 
   private static final Map<Constructor<?>,Predicate<Object[]>> brokenConstructors = new HashMap<>();
-  static {
+  static {  initBrokenConstructors(); }
+  @SuppressWarnings("deprecation")
+  private static void initBrokenConstructors() {
     try {
       brokenConstructors.put(
           LimitTokenCountFilter.class.getConstructor(TokenStream.class, int.class),
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/custom/TestCustomAnalyzer.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/custom/TestCustomAnalyzer.java
index 1afb90e..3816b81 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/custom/TestCustomAnalyzer.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/custom/TestCustomAnalyzer.java
@@ -48,7 +48,10 @@ import org.apache.lucene.util.SetOnce.AlreadySetException;
 import org.apache.lucene.util.Version;
 
 public class TestCustomAnalyzer extends BaseTokenStreamTestCase {
-  
+
+  @SuppressWarnings("deprecation")
+  private static final Version LUCENE_8_0_0 = Version.LUCENE_8_0_0;
+
   // Test some examples (TODO: we only check behavior, we may need something like TestRandomChains...)
 
   public void testWhitespaceFactoryWithFolding() throws Exception {
@@ -105,7 +108,7 @@ public class TestCustomAnalyzer extends BaseTokenStreamTestCase {
 
   public void testFactoryHtmlStripClassicFolding() throws Exception {
     CustomAnalyzer a = CustomAnalyzer.builder()
-        .withDefaultMatchVersion(Version.LUCENE_8_0_0)
+        .withDefaultMatchVersion(LUCENE_8_0_0)
         .addCharFilter(HTMLStripCharFilterFactory.class)
         .withTokenizer(ClassicTokenizerFactory.class)
         .addTokenFilter(ASCIIFoldingFilterFactory.class, "preserveOriginal", "true")
@@ -124,7 +127,7 @@ public class TestCustomAnalyzer extends BaseTokenStreamTestCase {
     assertSame(LowerCaseFilterFactory.class, tokenFilters.get(1).getClass());
     assertEquals(100, a.getPositionIncrementGap("dummy"));
     assertEquals(1000, a.getOffsetGap("dummy"));
-    assertSame(Version.LUCENE_8_0_0, a.getVersion());
+    assertSame(LUCENE_8_0_0, a.getVersion());
 
     assertAnalyzesTo(a, "<p>foo bar</p> FOO BAR", 
         new String[] { "foo", "bar", "foo", "bar" },
@@ -137,7 +140,7 @@ public class TestCustomAnalyzer extends BaseTokenStreamTestCase {
   
   public void testHtmlStripClassicFolding() throws Exception {
     CustomAnalyzer a = CustomAnalyzer.builder()
-        .withDefaultMatchVersion(Version.LUCENE_8_0_0)
+        .withDefaultMatchVersion(LUCENE_8_0_0)
         .addCharFilter("htmlstrip")
         .withTokenizer("classic")
         .addTokenFilter("asciifolding", "preserveOriginal", "true")
@@ -156,7 +159,7 @@ public class TestCustomAnalyzer extends BaseTokenStreamTestCase {
     assertSame(LowerCaseFilterFactory.class, tokenFilters.get(1).getClass());
     assertEquals(100, a.getPositionIncrementGap("dummy"));
     assertEquals(1000, a.getOffsetGap("dummy"));
-    assertSame(Version.LUCENE_8_0_0, a.getVersion());
+    assertSame(LUCENE_8_0_0, a.getVersion());
 
     assertAnalyzesTo(a, "<p>foo bar</p> FOO BAR", 
         new String[] { "foo", "bar", "foo", "bar" },
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilter.java
index 6121935..38cc651 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilter.java
@@ -75,6 +75,7 @@ public class TestConcatenateGraphFilter extends BaseTokenStreamTestCase {
     builder.add(new CharsRef("mykeyword"), new CharsRef("mysynonym"), true);
     Tokenizer tokenizer = new MockTokenizer(MockTokenizer.WHITESPACE, true);
     tokenizer.setReader(new StringReader("mykeyword"));
+    @SuppressWarnings("deprecation")
     SynonymFilter filter = new SynonymFilter(tokenizer, builder.build(), true);
     ConcatenateGraphFilter stream = new ConcatenateGraphFilter(filter);
     assertTokenStreamContents(stream, new String[] {"mykeyword", "mysynonym"}, null, null, new int[] { 1, 0 });
@@ -87,6 +88,7 @@ public class TestConcatenateGraphFilter extends BaseTokenStreamTestCase {
     Tokenizer tokenStream = new MockTokenizer(MockTokenizer.WHITESPACE, true);
     String input = "mykeyword another keyword";
     tokenStream.setReader(new StringReader(input));
+    @SuppressWarnings("deprecation")
     SynonymFilter filter = new SynonymFilter(tokenStream, builder.build(), true);
     ConcatenateGraphFilter stream = new ConcatenateGraphFilter(filter, SEP_LABEL, false, 100);
     String[] expectedOutputs = new String[2];
@@ -145,6 +147,7 @@ public class TestConcatenateGraphFilter extends BaseTokenStreamTestCase {
     }
     MockTokenizer tokenizer = new MockTokenizer(MockTokenizer.WHITESPACE, true);
     tokenizer.setReader(new StringReader(valueBuilder.toString()));
+    @SuppressWarnings("deprecation")
     SynonymFilter filter = new SynonymFilter(tokenizer, builder.build(), true);
 
     int count;
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilterFactory.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilterFactory.java
index 58937d4..34c2088 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilterFactory.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestConcatenateGraphFilterFactory.java
@@ -64,8 +64,9 @@ public class TestConcatenateGraphFilterFactory extends BaseTokenStreamFactoryTes
     tokenizer.setReader(reader);
     TokenStream stream = tokenizer;
     stream = new StopFilter(stream, StopFilter.makeStopSet("B2"));
+    @SuppressWarnings("deprecation") Version LUCENE_8_0_0 = Version.LUCENE_8_0_0;
     stream = tokenFilterFactory("ConcatenateGraph",
-        Version.LUCENE_8_0_0,
+        LUCENE_8_0_0,
         "preserveSep", "false"
     ).create(stream);
     assertTokenStreamContents(stream, new String[]{output});
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestFixBrokenOffsetsFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestFixBrokenOffsetsFilter.java
index ada5014..f311e35 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestFixBrokenOffsetsFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestFixBrokenOffsetsFilter.java
@@ -29,6 +29,7 @@ import org.apache.lucene.document.TextField;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.Directory;
 
+@Deprecated
 public class TestFixBrokenOffsetsFilter extends BaseTokenStreamTestCase {
 
   public void testBogusTermVectors() throws IOException {
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenPositionFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenPositionFilter.java
index 46d3025..a68dd86 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenPositionFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenPositionFilter.java
@@ -76,6 +76,7 @@ public class TestLimitTokenPositionFilter extends BaseTokenStreamTestCase {
       SynonymMap.Builder.join(new String[]{"dopple", "ganger"}, multiWordCharsRef);
       builder.add(new CharsRef("two"), multiWordCharsRef.get(), true);
       SynonymMap synonymMap = builder.build();
+      @SuppressWarnings("deprecation")
       TokenStream stream = new SynonymFilter(tokenizer, synonymMap, true);
       stream = new LimitTokenPositionFilter(stream, 3, consumeAll);
 
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java
index 43fa5b6..49cb4ce 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java
@@ -23,7 +23,7 @@ import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.core.KeywordTokenizer;
-import org.apache.lucene.analysis.synonym.SynonymFilter;
+import org.apache.lucene.analysis.synonym.SynonymGraphFilter;
 import org.apache.lucene.analysis.synonym.SynonymMap;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
@@ -156,7 +156,7 @@ public class TestRemoveDuplicatesTokenFilter extends BaseTokenStreamTestCase {
         @Override
         protected TokenStreamComponents createComponents(String fieldName) {
           Tokenizer tokenizer = new MockTokenizer(MockTokenizer.SIMPLE, true);
-          TokenStream stream = new SynonymFilter(tokenizer, map, ignoreCase);
+          TokenStream stream = new SynonymGraphFilter(tokenizer, map, ignoreCase);
           return new TokenStreamComponents(tokenizer, new RemoveDuplicatesTokenFilter(stream));
         }
       };
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java
index 060eb9b..ad36670 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java
@@ -37,25 +37,27 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.util.IOUtils;
 
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.CATENATE_ALL;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.CATENATE_NUMBERS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.CATENATE_WORDS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.GENERATE_NUMBER_PARTS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.GENERATE_WORD_PARTS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.IGNORE_KEYWORDS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.PRESERVE_ORIGINAL;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.SPLIT_ON_CASE_CHANGE;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.SPLIT_ON_NUMERICS;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.STEM_ENGLISH_POSSESSIVE;
-import static org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE;
-
 /**
  * New WordDelimiterFilter tests... most of the tests are in ConvertedLegacyTest
  * TODO: should explicitly test things like protWords and not rely on
  * the factory tests in Solr.
  */
+@Deprecated
 public class TestWordDelimiterFilter extends BaseTokenStreamTestCase {
 
+  private static final int CATENATE_ALL = WordDelimiterFilter.CATENATE_ALL;
+  private static final int CATENATE_NUMBERS = WordDelimiterFilter.CATENATE_NUMBERS;
+  private static final int CATENATE_WORDS = WordDelimiterFilter.CATENATE_WORDS;
+  private static final int GENERATE_NUMBER_PARTS = WordDelimiterFilter.GENERATE_NUMBER_PARTS;
+  private static final int GENERATE_WORD_PARTS = WordDelimiterFilter.GENERATE_WORD_PARTS;
+  private static final int IGNORE_KEYWORDS = WordDelimiterFilter.IGNORE_KEYWORDS;
+  private static final int PRESERVE_ORIGINAL = WordDelimiterFilter.PRESERVE_ORIGINAL;
+  private static final int SPLIT_ON_CASE_CHANGE = WordDelimiterFilter.SPLIT_ON_CASE_CHANGE;
+  private static final int SPLIT_ON_NUMERICS = WordDelimiterFilter.SPLIT_ON_NUMERICS;
+  private static final int STEM_ENGLISH_POSSESSIVE = WordDelimiterFilter.STEM_ENGLISH_POSSESSIVE;
+  private static final byte[] DEFAULT_WORD_DELIM_TABLE = WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE;
+
+
   /*
   public void testPerformance() throws IOException {
     String s = "now is the time-for all good men to come to-the aid of their country.";
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java
index 7fbea5f..c2a9892 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java
@@ -120,7 +120,7 @@ public class EdgeNGramTokenizerTest extends BaseTokenStreamTestCase {
   }
 
   private static void testNGrams(int minGram, int maxGram, int length, final String nonTokenChars) throws IOException {
-    final String s = RandomStrings.randomAsciiOfLength(random(), length);
+    final String s = RandomStrings.randomAsciiLettersOfLengthBetween(random(), length, length);
     testNGrams(minGram, maxGram, s, nonTokenChars);
   }
 
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java
index 453c5db..c66965b 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java
@@ -120,7 +120,7 @@ public class NGramTokenizerTest extends BaseTokenStreamTestCase {
   }
 
   private static void testNGrams(int minGram, int maxGram, int length, final String nonTokenChars) throws IOException {
-    final String s = RandomStrings.randomAsciiOfLength(random(), length);
+    final String s = RandomStrings.randomAsciiLettersOfLengthBetween(random(), length, length);
     testNGrams(minGram, maxGram, s, nonTokenChars);
   }
 
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSolrSynonymParser.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSolrSynonymParser.java
index 748b177..08ea972 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSolrSynonymParser.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSolrSynonymParser.java
@@ -30,6 +30,7 @@ import org.apache.lucene.analysis.en.EnglishAnalyzer;
  * Tests parser for the Solr synonyms format
  * @lucene.experimental
  */
+@Deprecated
 public class TestSolrSynonymParser extends BaseSynonymParserTestCase {
   
   /** Tests some simple examples from the solr wiki */
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilterFactory.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilterFactory.java
index e3bb00a..13adaef 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilterFactory.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilterFactory.java
@@ -27,6 +27,7 @@ import org.apache.lucene.analysis.util.StringMockResourceLoader;
 import org.apache.lucene.analysis.cjk.CJKAnalyzer;
 import org.apache.lucene.util.Version;
 
+@Deprecated
 public class TestSynonymFilterFactory extends BaseTokenStreamFactoryTestCase {
 
   /** checks for synonyms of "GB" in synonyms.txt */
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
index c7c8af7..af88c57 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
@@ -39,6 +39,7 @@ import org.apache.lucene.analysis.tokenattributes.*;
 import org.apache.lucene.util.CharsRefBuilder;
 import org.apache.lucene.util.TestUtil;
 
+@Deprecated
 public class TestSynonymMapFilter extends BaseTokenStreamTestCase {
 
   private SynonymMap.Builder b;
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestWordnetSynonymParser.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestWordnetSynonymParser.java
index 2449f8f..8184172 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestWordnetSynonymParser.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestWordnetSynonymParser.java
@@ -36,7 +36,8 @@ public class TestWordnetSynonymParser extends BaseTokenStreamTestCase {
     "s(100000003,2,'baron',n,1,1).\n" +
     "s(100000004,1,'king''s evil',n,1,1).\n" +
     "s(100000004,2,'king''s meany',n,1,1).\n";
-  
+
+  @SuppressWarnings("deprecation")
   public void testSynonyms() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     WordnetSynonymParser parser = new WordnetSynonymParser(true, true, analyzer);
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestFilesystemResourceLoader.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestFilesystemResourceLoader.java
index eaa6174..c37edca 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestFilesystemResourceLoader.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestFilesystemResourceLoader.java
@@ -53,7 +53,7 @@ public class TestFilesystemResourceLoader extends LuceneTestCase {
     assertEquals("org.apache.lucene.analysis.util.RollingCharBuffer",
         rl.newInstance("org.apache.lucene.analysis.util.RollingCharBuffer", Object.class).getClass().getName());
   }
-  
+
   public void testBaseDir() throws Exception {
     final Path base = createTempDir("fsResourceLoaderBase");
     Writer os = Files.newBufferedWriter(base.resolve("template.txt"), StandardCharsets.UTF_8);
@@ -62,7 +62,8 @@ public class TestFilesystemResourceLoader extends LuceneTestCase {
     } finally {
       IOUtils.closeWhileHandlingException(os);
     }
-      
+
+    @SuppressWarnings("deprecation")
     ResourceLoader rl = new FilesystemResourceLoader(base);
     assertEquals("foobar", WordlistLoader.getLines(rl.openResource("template.txt"), StandardCharsets.UTF_8).get(0));
     // Same with full path name:
diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilter.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilter.java
index bfe7c12..35f1410 100644
--- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilter.java
+++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilter.java
@@ -73,6 +73,7 @@ public final class ICUTransformFilter extends TokenFilter {
    * @param input {@link TokenStream} to filter.
    * @param transform Transliterator to transform the text.
    */
+  @SuppressWarnings("deprecation")
   public ICUTransformFilter(TokenStream input, Transliterator transform) {
     super(input);
     this.transform = transform;
diff --git a/lucene/classification/src/test/org/apache/lucene/classification/document/DocumentClassificationTestBase.java b/lucene/classification/src/test/org/apache/lucene/classification/document/DocumentClassificationTestBase.java
index 3848151..bdf3ed8 100644
--- a/lucene/classification/src/test/org/apache/lucene/classification/document/DocumentClassificationTestBase.java
+++ b/lucene/classification/src/test/org/apache/lucene/classification/document/DocumentClassificationTestBase.java
@@ -36,7 +36,7 @@ import org.junit.Before;
 /**
  * Base class for testing {@link org.apache.lucene.classification.Classifier}s
  */
-public abstract class DocumentClassificationTestBase<T> extends ClassificationTestBase {
+public abstract class DocumentClassificationTestBase<T> extends ClassificationTestBase<T>{
 
   protected static final BytesRef VIDEOGAME_RESULT = new BytesRef("videogames");
   protected static final BytesRef VIDEOGAME_ANALYZED_RESULT = new BytesRef("videogam");
diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java
index bc9806d..c6ea6f2 100644
--- a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java
+++ b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java
@@ -33,6 +33,7 @@ import org.apache.lucene.util.SuppressForbidden;
 @SuppressForbidden(reason = "Uses a Long instance as a marker")
 public final class PositiveIntOutputs extends Outputs<Long> {
   
+  @SuppressWarnings("deprecation")
   private final static Long NO_OUTPUT = new Long(0);
 
   private final static PositiveIntOutputs singleton = new PositiveIntOutputs();
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java b/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
index 85e7ea8..dab9a4b 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
@@ -90,6 +90,7 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
 
     // bulk get
     assert index % valuesPerBlock == 0;
+    @SuppressWarnings("deprecation")
     final PackedInts.Decoder decoder = BulkOperation.of(PackedInts.Format.PACKED_SINGLE_BLOCK, bitsPerValue);
     assert decoder.longBlockCount() == 1;
     assert decoder.longValueCount() == valuesPerBlock;
@@ -134,6 +135,7 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
 
     // bulk set
     assert index % valuesPerBlock == 0;
+    @SuppressWarnings("deprecation")
     final BulkOperation op = BulkOperation.of(PackedInts.Format.PACKED_SINGLE_BLOCK, bitsPerValue);
     assert op.longBlockCount() == 1;
     assert op.longValueCount() == valuesPerBlock;
@@ -195,6 +197,7 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
   }
 
   @Override
+  @SuppressWarnings("deprecation")
   protected PackedInts.Format getFormat() {
     return PackedInts.Format.PACKED_SINGLE_BLOCK;
   }
diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java
index 8430eb8..1a32a80 100644
--- a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java
+++ b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java
@@ -61,15 +61,19 @@ public class TestCharArraySet extends LuceneTestCase {
   public void testObjectContains() {
     CharArraySet set = new CharArraySet(10, true);
     Integer val = Integer.valueOf(1);
+    @SuppressWarnings("deprecation")
+    Integer val1 = new Integer(1);
+    // Verify explicitly the case of different Integer instances
+    assertNotSame(val, val1);
     set.add(val);
     assertTrue(set.contains(val));
-    assertTrue(set.contains(new Integer(1))); // another integer
+    assertTrue(set.contains(val1)); // another integer
     assertTrue(set.contains("1"));
     assertTrue(set.contains(new char[]{'1'}));
     // test unmodifiable
     set = CharArraySet.unmodifiableSet(set);
     assertTrue(set.contains(val));
-    assertTrue(set.contains(new Integer(1))); // another integer
+    assertTrue(set.contains(val1)); // another integer
     assertTrue(set.contains("1"));
     assertTrue(set.contains(new char[]{'1'}));
   }
diff --git a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java b/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
index 50c1ed0..ac5c434 100644
--- a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
+++ b/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
@@ -214,14 +214,10 @@ public class TestDocument extends LuceneTestCase {
 
   public void testGetValues() {
     Document doc = makeDocumentWithFields();
-    assertEquals(new String[] {"test1", "test2"},
-                 doc.getValues("keyword"));
-    assertEquals(new String[] {"test1", "test2"},
-                 doc.getValues("text"));
-    assertEquals(new String[] {"test1", "test2"},
-                 doc.getValues("unindexed"));
-    assertEquals(new String[0],
-                 doc.getValues("nope"));
+    assertArrayEquals(new String[] {"test1", "test2"}, doc.getValues("keyword"));
+    assertArrayEquals(new String[] {"test1", "test2"}, doc.getValues("text"));
+    assertArrayEquals(new String[] {"test1", "test2"}, doc.getValues("unindexed"));
+    assertArrayEquals(new String[0], doc.getValues("nope"));
   }
   
   public void testPositionIncrementMultiFields() throws Exception {
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java b/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
index 69e1e10..f4a2543 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
@@ -28,13 +28,12 @@ import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.io.IOException;
 
-import junit.framework.Assert;
-
 public class TestMultiTermConstantScore extends BaseTestRangeFilter {
 
   /** threshold for comparing floats */
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
index 9dc9843..59a8de9 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
@@ -295,7 +295,7 @@ public class TestSearchAfter extends LuceneTestCase {
       assertEquals(sd1.score, sd2.score, 0f);
       if (sd1 instanceof FieldDoc) {
         assertTrue(sd2 instanceof FieldDoc);
-        assertEquals(((FieldDoc) sd1).fields, ((FieldDoc) sd2).fields);
+        assertArrayEquals(((FieldDoc) sd1).fields, ((FieldDoc) sd2).fields);
       }
     }
   }
diff --git a/lucene/core/src/test/org/apache/lucene/util/TestCharsRef.java b/lucene/core/src/test/org/apache/lucene/util/TestCharsRef.java
index 079b3b7..fd9d639 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestCharsRef.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestCharsRef.java
@@ -20,6 +20,8 @@ import java.util.Arrays;
 
 
 public class TestCharsRef extends LuceneTestCase {
+
+  @SuppressWarnings("deprecation")
   public void testUTF16InUTF8Order() {
     final int numStrings = atLeast(1000);
     BytesRef utf8[] = new BytesRef[numStrings];
diff --git a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
index e19c615..02d566e 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
@@ -23,6 +23,7 @@ import java.text.ParseException;
 import java.util.Locale;
 import java.util.Random;
 
+@SuppressWarnings("deprecation")
 public class TestVersion extends LuceneTestCase {
 
   public void testOnOrAfter() throws Exception {
diff --git a/lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java b/lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java
index 9ee6947..4ac9f96 100644
--- a/lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java
+++ b/lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java
@@ -256,7 +256,9 @@ public class Test2BFST extends LuceneTestCase {
             // forward lookup:
             assertEquals(output, Util.get(fst, input).longValue());
             // reverse lookup:
-            assertEquals(input, Util.getByOutput(fst, output));
+            @SuppressWarnings("deprecation")
+            IntsRef inputResult = Util.getByOutput(fst, output);
+            assertEquals(input, inputResult);
             output += 1 + r.nextInt(10);
             nextInput(r, ints);
           }
diff --git a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
index e081f6c..86a7671 100644
--- a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
+++ b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
@@ -570,7 +570,7 @@ public class TestFSTs extends LuceneTestCase {
               } else {
                 // Get by output
                 final Long output = (Long) getOutput(intsRef.get(), ord);
-                @SuppressWarnings("unchecked") final IntsRef actual = Util.getByOutput((FST<Long>) fst, output.longValue());
+                @SuppressWarnings({"unchecked", "deprecation"}) final IntsRef actual = Util.getByOutput((FST<Long>) fst, output.longValue());
                 if (actual == null) {
                   throw new RuntimeException("unexpected null input from output=" + output);
                 }
@@ -833,13 +833,17 @@ public class TestFSTs extends LuceneTestCase {
     assertEquals(b, seekResult.input);
     assertEquals(42, (long) seekResult.output);
 
-    assertEquals(Util.toIntsRef(new BytesRef("c"), new IntsRefBuilder()),
-                 Util.getByOutput(fst, 13824324872317238L));
-    assertNull(Util.getByOutput(fst, 47));
-    assertEquals(Util.toIntsRef(new BytesRef("b"), new IntsRefBuilder()),
-                 Util.getByOutput(fst, 42));
-    assertEquals(Util.toIntsRef(new BytesRef("a"), new IntsRefBuilder()),
-                 Util.getByOutput(fst, 17));
+    @SuppressWarnings("deprecation") IntsRef byOutput = Util.getByOutput(fst, 13824324872317238L);
+    assertEquals(Util.toIntsRef(new BytesRef("c"), new IntsRefBuilder()), byOutput);
+
+    @SuppressWarnings("deprecation") IntsRef byOutput47 = Util.getByOutput(fst, 47);
+    assertNull(byOutput47);
+
+    @SuppressWarnings("deprecation") IntsRef byOutput42 = Util.getByOutput(fst, 42);
+    assertEquals(Util.toIntsRef(new BytesRef("b"), new IntsRefBuilder()), byOutput42);
+
+    @SuppressWarnings("deprecation") IntsRef byOutput17 = Util.getByOutput(fst, 17);
+    assertEquals(Util.toIntsRef(new BytesRef("a"), new IntsRefBuilder()), byOutput17);
   }
 
   public void testPrimaryKeys() throws Exception {
diff --git a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
index 27ac460..497052b 100644
--- a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
+++ b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
@@ -836,7 +836,9 @@ public class TestPackedInts extends LuceneTestCase {
         final long[] blocks = new long[blocksOffset + blocksLen];
         for (int i = 0; i < blocks.length; ++i) {
           blocks[i] = random().nextLong();
-          if (format == PackedInts.Format.PACKED_SINGLE_BLOCK && 64 % bpv != 0) {
+          @SuppressWarnings("deprecation")
+          PackedInts.Format PACKED_SINGLE_BLOCK = PackedInts.Format.PACKED_SINGLE_BLOCK;
+          if (format == PACKED_SINGLE_BLOCK && 64 % bpv != 0) {
             // clear highest bits for packed
             final int toClear = 64 % bpv;
             blocks[i] = (blocks[i] << toClear) >>> toClear;
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/DrillSideways.java b/lucene/facet/src/java/org/apache/lucene/facet/DrillSideways.java
index 15df7e3..6dbacf1 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/DrillSideways.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/DrillSideways.java
@@ -299,7 +299,7 @@ public class DrillSideways {
     if (executor != null) {  // We have an executor, let use the multi-threaded version
 
       final CollectorManager<TopScoreDocCollector, TopDocs> collectorManager =
-              new CollectorManager<TopScoreDocCollector, TopDocs>() {
+              new CollectorManager<>() {
 
                 @Override
                 public TopScoreDocCollector newCollector() throws IOException {
@@ -404,6 +404,7 @@ public class DrillSideways {
   }
 
   /** Runs a search, using a {@link CollectorManager} to gather and merge search results */
+  @SuppressWarnings("unchecked")
   public <R> ConcurrentDrillSidewaysResult<R> search(final DrillDownQuery query,
           final CollectorManager<?, R> hitCollectorManager) throws IOException {
 
diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupingSearch.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupingSearch.java
index 55fda8b..25ed377 100644
--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupingSearch.java
+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupingSearch.java
@@ -86,7 +86,7 @@ public class GroupingSearch {
    * @param groupFunction      The function to group by specified as {@link ValueSource}
    * @param valueSourceContext The context of the specified groupFunction
    */
-  public GroupingSearch(ValueSource groupFunction, Map<?, ?> valueSourceContext) {
+  public GroupingSearch(ValueSource groupFunction, Map<Object, Object> valueSourceContext) {
     this(new ValueSourceGroupSelector(groupFunction, valueSourceContext), null);
   }
 
diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/ValueSourceGroupSelector.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/ValueSourceGroupSelector.java
index 8ff945a..54373de 100644
--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/ValueSourceGroupSelector.java
+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/ValueSourceGroupSelector.java
@@ -35,7 +35,7 @@ import org.apache.lucene.util.mutable.MutableValue;
 public class ValueSourceGroupSelector extends GroupSelector<MutableValue> {
 
   private final ValueSource valueSource;
-  private final Map<?, ?> context;
+  private final Map<Object, Object> context;
 
   private Set<MutableValue> secondPassGroups;
 
@@ -44,7 +44,7 @@ public class ValueSourceGroupSelector extends GroupSelector<MutableValue> {
    * @param valueSource the ValueSource to group by
    * @param context     a context map for the ValueSource
    */
-  public ValueSourceGroupSelector(ValueSource valueSource, Map<?, ?> context) {
+  public ValueSourceGroupSelector(ValueSource valueSource, Map<Object, Object> context) {
     this.valueSource = valueSource;
     this.context = context;
   }
diff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/BaseGroupSelectorTestCase.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/BaseGroupSelectorTestCase.java
index 610ded9..bb2a946 100644
--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/BaseGroupSelectorTestCase.java
+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/BaseGroupSelectorTestCase.java
@@ -310,7 +310,7 @@ public abstract class BaseGroupSelectorTestCase<T> extends AbstractGroupingTestC
 
     // TODO why does SearchGroup.merge() take a list but TopGroups.merge() take an array?
     @SuppressWarnings("unchecked")
-    TopGroups<T>[] shardTopGroups = new TopGroups[shards.length];
+    TopGroups<T>[] shardTopGroups = (TopGroups<T>[]) new TopGroups<?>[shards.length];
     int j = 0;
     for (Shard shard : shards) {
       TopGroupsCollector<T> sc = new TopGroupsCollector<>(getGroupSelector(), mergedGroups, sort, Sort.RELEVANCE, 5, true);
diff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
index f1ce508..4ef6c02 100644
--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
@@ -287,9 +287,11 @@ public class TestGrouping extends LuceneTestCase {
 
   private Collection<SearchGroup<BytesRef>> getSearchGroups(FirstPassGroupingCollector<?> c, int groupOffset) throws IOException {
     if (TermGroupSelector.class.isAssignableFrom(c.getGroupSelector().getClass())) {
+      @SuppressWarnings("unchecked")
       FirstPassGroupingCollector<BytesRef> collector = (FirstPassGroupingCollector<BytesRef>) c;
       return collector.getTopGroups(groupOffset);
     } else if (ValueSourceGroupSelector.class.isAssignableFrom(c.getGroupSelector().getClass())) {
+      @SuppressWarnings("unchecked")
       FirstPassGroupingCollector<MutableValue> collector = (FirstPassGroupingCollector<MutableValue>) c;
       Collection<SearchGroup<MutableValue>> mutableValueGroups = collector.getTopGroups(groupOffset);
       if (mutableValueGroups == null) {
diff --git a/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java b/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
index fef167e..605e859 100644
--- a/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
+++ b/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
@@ -30,6 +30,8 @@ import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BitSet;
 import org.apache.lucene.util.NumericUtils;
 
+import static org.apache.lucene.search.join.BlockJoinSelector.toIter;
+
 /**
  * A special sort field that allows sorting parent docs based on nested / child level fields.
  * Based on the sort order it either takes the document with the lowest or highest field value into account.
@@ -118,7 +120,7 @@ public class ToParentBlockJoinSortField extends SortField {
         if (children == null) {
           return DocValues.emptySorted();
         }
-        return BlockJoinSelector.wrap(sortedSet, type, parents, children);
+        return BlockJoinSelector.wrap(sortedSet, type, parents, toIter(children));
       }
 
     };
@@ -137,7 +139,7 @@ public class ToParentBlockJoinSortField extends SortField {
         if (children == null) {
           return DocValues.emptyNumeric();
         }
-        return BlockJoinSelector.wrap(sortedNumeric, type, parents, children);
+        return BlockJoinSelector.wrap(sortedNumeric, type, parents, toIter(children));
       }
     };
   }
@@ -155,7 +157,7 @@ public class ToParentBlockJoinSortField extends SortField {
         if (children == null) {
           return DocValues.emptyNumeric();
         }
-        return BlockJoinSelector.wrap(sortedNumeric, type, parents, children);
+        return BlockJoinSelector.wrap(sortedNumeric, type, parents, toIter(children));
       }
     };
   }
@@ -173,7 +175,7 @@ public class ToParentBlockJoinSortField extends SortField {
         if (children == null) {
           return DocValues.emptyNumeric();
         }
-        return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, children)) {
+        return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, toIter(children))) {
           @Override
           public long longValue() throws IOException {
             // undo the numericutils sortability
@@ -197,7 +199,7 @@ public class ToParentBlockJoinSortField extends SortField {
         if (children == null) {
           return DocValues.emptyNumeric();
         }
-        return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, children)) {
+        return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, toIter(children))) {
           @Override
           public long longValue() throws IOException {
             // undo the numericutils sortability
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
index 838826f..29e088b 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
@@ -17,6 +17,7 @@
 package org.apache.lucene.search.join;
 
 import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+import static org.apache.lucene.search.join.BlockJoinSelector.toIter;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -132,14 +133,14 @@ public class TestBlockJoinSelector extends LuceneTestCase {
     ords[12] = 10;
     ords[18] = 10;
 
-    final SortedDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MIN, parents, children);
+    final SortedDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MIN, parents, toIter(children));
     assertEquals(5, nextDoc(mins,5));
     assertEquals(3, mins.ordValue());
     assertEquals(15, nextDoc(mins,15));
     assertEquals(10, mins.ordValue());
     assertNoMoreDoc(mins, 20);
 
-    final SortedDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MAX, parents, children);
+    final SortedDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MAX, parents, toIter(children));
     assertEquals(5, nextDoc(maxs,5));
     assertEquals(7, maxs.ordValue());
     assertEquals(15, nextDoc(maxs,15));
@@ -246,14 +247,14 @@ public class TestBlockJoinSelector extends LuceneTestCase {
     docsWithValue.set(18);
     longs[18] = 10;
 
-    final NumericDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MIN, parents, children);
+    final NumericDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MIN, parents, toIter(children));
     assertEquals(5, nextDoc(mins,5));
     assertEquals(3, mins.longValue());
     assertEquals(15, nextDoc(mins,15));
     assertEquals(10, mins.longValue());
     assertNoMoreDoc(mins, 20);
 
-    final NumericDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MAX, parents, children);
+    final NumericDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MAX, parents, toIter(children));
     assertEquals(5, nextDoc(maxs, 5));
     assertEquals(7, maxs.longValue());
     assertEquals(15, nextDoc(maxs, 15));
diff --git a/lucene/misc/src/java/org/apache/lucene/util/fst/UpToTwoPositiveIntOutputs.java b/lucene/misc/src/java/org/apache/lucene/util/fst/UpToTwoPositiveIntOutputs.java
index af1766e..a6e0a66 100644
--- a/lucene/misc/src/java/org/apache/lucene/util/fst/UpToTwoPositiveIntOutputs.java
+++ b/lucene/misc/src/java/org/apache/lucene/util/fst/UpToTwoPositiveIntOutputs.java
@@ -82,7 +82,8 @@ public final class UpToTwoPositiveIntOutputs extends Outputs<Object> {
       return (int) ((first^(first>>>32)) ^ (second^(second>>32)));
     }
   }
-  
+
+  @SuppressWarnings("deprecation")
   private final static Long NO_OUTPUT = new Long(0);
 
   private final boolean doShare;
diff --git a/lucene/misc/src/test/org/apache/lucene/search/similarity/TestLegacyBM25Similarity.java b/lucene/misc/src/test/org/apache/lucene/search/similarity/TestLegacyBM25Similarity.java
index b3a0cd2..9ffdc63 100644
--- a/lucene/misc/src/test/org/apache/lucene/search/similarity/TestLegacyBM25Similarity.java
+++ b/lucene/misc/src/test/org/apache/lucene/search/similarity/TestLegacyBM25Similarity.java
@@ -23,6 +23,7 @@ import org.apache.lucene.search.similarities.BM25Similarity;
 import org.apache.lucene.search.similarities.BaseSimilarityTestCase;
 import org.apache.lucene.search.similarities.Similarity;
 
+@Deprecated
 public class TestLegacyBM25Similarity extends BaseSimilarityTestCase {
 
   public void testIllegalK1() {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
index c804523..9bd9ccc 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
@@ -56,7 +56,7 @@ public class FunctionQuery extends Query {
   protected class FunctionWeight extends Weight {
     protected final IndexSearcher searcher;
     protected final float boost;
-    protected final Map context;
+    protected final Map<Object, Object> context;
 
     public FunctionWeight(IndexSearcher searcher, float boost) throws IOException {
       super(FunctionQuery.this);
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionRangeQuery.java b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionRangeQuery.java
index f72e12b..7848dc6 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionRangeQuery.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionRangeQuery.java
@@ -124,8 +124,7 @@ public class FunctionRangeQuery extends Query {
   }
 
   private class FunctionRangeWeight extends Weight {
-    @SuppressWarnings("rawtypes")
-    private final Map vsContext;
+    private final Map<Object, Object> vsContext;
 
     public FunctionRangeWeight(IndexSearcher searcher) throws IOException {
       super(FunctionRangeQuery.this);
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSource.java
index 1ba3580..0b3421d 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSource.java
@@ -50,7 +50,7 @@ public abstract class ValueSource {
    * docID manner, and you must call this method again to iterate through
    * the values again.
    */
-  public abstract FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException;
+  public abstract FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException;
 
   @Override
   public abstract boolean equals(Object o);
@@ -74,14 +74,14 @@ public abstract class ValueSource {
    * weight info in the context. The context object will be passed to getValues()
    * where this info can be retrieved.
    */
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
   }
 
   /**
    * Returns a new non-threadsafe context map.
    */
-  public static Map newContext(IndexSearcher searcher) {
-    Map context = new IdentityHashMap();
+  public static Map<Object, Object> newContext(IndexSearcher searcher) {
+    Map<Object, Object> context = new IdentityHashMap<>();
     context.put("searcher", searcher);
     return context;
   }
@@ -119,7 +119,7 @@ public abstract class ValueSource {
 
     @Override
     public LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
-      Map context = new IdentityHashMap<>();
+      Map<Object, Object> context = new IdentityHashMap<>();
       ScoreAndDoc scorer = new ScoreAndDoc();
       context.put("scorer", scorer);
       final FunctionValues fv = in.getValues(context, ctx);
@@ -196,7 +196,7 @@ public abstract class ValueSource {
 
     @Override
     public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
-      Map context = new HashMap<>();
+      Map<Object, Object> context = new HashMap<>();
       ScoreAndDoc scorer = new ScoreAndDoc();
       context.put("scorer", scorer);
       context.put("searcher", searcher);
@@ -236,7 +236,7 @@ public abstract class ValueSource {
 
     @Override
     public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException {
-      Map context = new HashMap<>();
+      Map<Object, Object> context = new HashMap<>();
       ScoreAndDoc scorer = new ScoreAndDoc();
       scorer.score = scoreExplanation.getValue().floatValue();
       context.put("scorer", scorer);
@@ -283,7 +283,7 @@ public abstract class ValueSource {
     }
 
     @Override
-    public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+    public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
       Scorable scorer = (Scorable) context.get("scorer");
       DoubleValues scores = scorer == null ? null : DoubleValuesSource.fromScorer(scorer);
 
@@ -365,16 +365,16 @@ public abstract class ValueSource {
 
     @Override
     public SortField rewrite(IndexSearcher searcher) throws IOException {
-      Map context = newContext(searcher);
+      Map<Object, Object> context = newContext(searcher);
       createWeight(context, searcher);
       return new SortField(getField(), new ValueSourceComparatorSource(context), getReverse());
     }
   }
 
   class ValueSourceComparatorSource extends FieldComparatorSource {
-    private final Map context;
+    private final Map<Object, Object> context;
 
-    public ValueSourceComparatorSource(Map context) {
+    public ValueSourceComparatorSource(Map<Object, Object> context) {
       this.context = context;
     }
 
@@ -394,10 +394,10 @@ public abstract class ValueSource {
     private final double[] values;
     private FunctionValues docVals;
     private double bottom;
-    private final Map fcontext;
+    private final Map<Object, Object> fcontext;
     private double topValue;
 
-    ValueSourceComparator(Map fcontext, int numHits) {
+    ValueSourceComparator(Map<Object, Object> fcontext, int numHits) {
       this.fcontext = fcontext;
       values = new double[numHits];
     }
@@ -429,7 +429,7 @@ public abstract class ValueSource {
 
     @Override
     public void setTopValue(final Double value) {
-      this.topValue = value.doubleValue();
+      this.topValue = value;
     }
 
     @Override
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java
index bb33122..af7ae3d 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java
@@ -41,7 +41,7 @@ public class BytesRefFieldSource extends FieldCacheSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FieldInfo fieldInfo = readerContext.reader().getFieldInfos().fieldInfo(field);
 
     // To be sorted or not to be sorted, that is the question
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ComparisonBoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ComparisonBoolFunction.java
index 1a936d9..57adf6b 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ComparisonBoolFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ComparisonBoolFunction.java
@@ -50,7 +50,7 @@ public abstract class ComparisonBoolFunction extends BoolFunction {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues lhsVal = this.lhs.getValues(context, readerContext);
     final FunctionValues rhsVal = this.rhs.getValues(context, readerContext);
     final String compLabel = this.name();
@@ -97,7 +97,7 @@ public abstract class ComparisonBoolFunction extends BoolFunction {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     lhs.createWeight(context, searcher);
     rhs.createWeight(context, searcher);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ConstValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ConstValueSource.java
index 125422f..b9fda15 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ConstValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ConstValueSource.java
@@ -41,7 +41,7 @@ public class ConstValueSource extends ConstNumberSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return new FloatDocValues(this) {
       @Override
       public float floatVal(int doc) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java
index f3fd004..2c6f2a9 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DefFunction.java
@@ -42,7 +42,7 @@ public class DefFunction extends MultiFunction {
 
 
   @Override
-  public FunctionValues getValues(Map fcontext, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> fcontext, LeafReaderContext readerContext) throws IOException {
 
 
     return new Values(valsArr(sources, fcontext, readerContext)) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DocFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DocFreqValueSource.java
index bb67627..f7abe36 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DocFreqValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DocFreqValueSource.java
@@ -57,15 +57,15 @@ public class DocFreqValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     int docfreq = searcher.getIndexReader().docFreq(new Term(indexedField, indexedBytes));
     return new ConstIntDocValues(docfreq, this);
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
-    context.put("searcher",searcher);
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
+    context.put("searcher", searcher);
   }
 
   @Override
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleConstValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleConstValueSource.java
index 74a4774..21b20aa 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleConstValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleConstValueSource.java
@@ -43,7 +43,7 @@ public class DoubleConstValueSource extends ConstNumberSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return new DoubleDocValues(this) {
       @Override
       public float floatVal(int doc) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
index 3f5f454..1bb6625 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DoubleFieldSource.java
@@ -50,7 +50,7 @@ public class DoubleFieldSource extends FieldCacheSource {
   }
   
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
 
     final NumericDocValues values = getNumericDocValues(context, readerContext);
 
@@ -104,7 +104,7 @@ public class DoubleFieldSource extends FieldCacheSource {
     };
   }
 
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return DocValues.getNumeric(readerContext.reader(), field);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java
index e42ba65..745753b 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/DualFloatFunction.java
@@ -51,7 +51,7 @@ public abstract class DualFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues aVals =  a.getValues(context, readerContext);
     final FunctionValues bVals =  b.getValues(context, readerContext);
     return new FloatDocValues(this) {
@@ -75,7 +75,7 @@ public abstract class DualFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     a.createWeight(context,searcher);
     b.createWeight(context,searcher);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/EnumFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/EnumFieldSource.java
index 21dbfab..d575277 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/EnumFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/EnumFieldSource.java
@@ -94,7 +94,7 @@ public class EnumFieldSource extends FieldCacheSource {
 
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final NumericDocValues arr = DocValues.getNumeric(readerContext.reader(), field);
 
     return new IntDocValues(this) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/FloatFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/FloatFieldSource.java
index 87285f4..346c79f 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/FloatFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/FloatFieldSource.java
@@ -50,7 +50,7 @@ public class FloatFieldSource extends FieldCacheSource {
   }
   
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
 
     final NumericDocValues arr = getNumericDocValues(context, readerContext);
     
@@ -105,7 +105,7 @@ public class FloatFieldSource extends FieldCacheSource {
     };
   }
 
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return DocValues.getNumeric(readerContext.reader(), field);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java
index 7d2afb1..363f399 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java
@@ -45,7 +45,7 @@ public class IDFValueSource extends DocFreqValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     TFIDFSimilarity sim = asTFIDF(searcher.getSimilarity(), field);
     if (sim == null) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IfFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IfFunction.java
index 45d18db..0d868d3 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IfFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IfFunction.java
@@ -43,7 +43,7 @@ public class IfFunction extends BoolFunction {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues ifVals = ifSource.getValues(context, readerContext);
     final FunctionValues trueVals = trueSource.getValues(context, readerContext);
     final FunctionValues falseVals = falseSource.getValues(context, readerContext);
@@ -142,7 +142,7 @@ public class IfFunction extends BoolFunction {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     ifSource.createWeight(context, searcher);
     trueSource.createWeight(context, searcher);
     falseSource.createWeight(context, searcher);
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
index 8d2ab7f..d8e0def 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IntFieldSource.java
@@ -50,7 +50,7 @@ public class IntFieldSource extends FieldCacheSource {
   }
   
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     
     final NumericDocValues arr = getNumericDocValues(context, readerContext);
 
@@ -109,7 +109,7 @@ public class IntFieldSource extends FieldCacheSource {
     };
   }
 
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return DocValues.getNumeric(readerContext.reader(), field);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java
index 4e51ac6..e20aaf5 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java
@@ -53,7 +53,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException
   {
     final BinaryDocValues terms = DocValues.getBinary(readerContext.reader(), field);
     final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader();
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LinearFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LinearFloatFunction.java
index bbc7419..66daaf2 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LinearFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LinearFloatFunction.java
@@ -50,7 +50,7 @@ public class LinearFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues vals =  source.getValues(context, readerContext);
     return new FloatDocValues(this) {
       @Override
@@ -69,7 +69,7 @@ public class LinearFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LiteralValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LiteralValueSource.java
index aeb3b49..f5b4547 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LiteralValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LiteralValueSource.java
@@ -45,7 +45,7 @@ public class LiteralValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
 
     return new StrDocValues(this) {
       @Override
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
index 8474362..f728b0a 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/LongFieldSource.java
@@ -62,7 +62,7 @@ public class LongFieldSource extends FieldCacheSource {
   }
   
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     
     final NumericDocValues arr = getNumericDocValues(context, readerContext);
 
@@ -142,7 +142,7 @@ public class LongFieldSource extends FieldCacheSource {
     };
   }
 
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return DocValues.getNumeric(readerContext.reader(), field);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MaxDocValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MaxDocValueSource.java
index 87eeddc..1d828a0 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MaxDocValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MaxDocValueSource.java
@@ -41,12 +41,12 @@ public class MaxDocValueSource extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
-    context.put("searcher",searcher);
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
+    context.put("searcher", searcher);
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     return new DocFreqValueSource.ConstIntDocValues(searcher.getIndexReader().maxDoc(), this);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java
index 6e905bf..b89a42a 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiBoolFunction.java
@@ -42,7 +42,7 @@ public abstract class MultiBoolFunction extends BoolFunction {
   protected abstract boolean func(int doc, FunctionValues[] vals) throws IOException;
 
   @Override
-  public BoolDocValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public BoolDocValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues[] vals =  new FunctionValues[sources.size()];
     int i=0;
     for (ValueSource source : sources) {
@@ -104,7 +104,7 @@ public abstract class MultiBoolFunction extends BoolFunction {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     for (ValueSource source : sources) {
       source.createWeight(context, searcher);
     }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java
index f2deb21..f5f57c9 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFloatFunction.java
@@ -70,7 +70,7 @@ public abstract class MultiFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues[] valsArr = new FunctionValues[sources.length];
     for (int i=0; i<sources.length; i++) {
       valsArr[i] = sources[i].getValues(context, readerContext);
@@ -92,7 +92,7 @@ public abstract class MultiFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     for (ValueSource source : sources)
       source.createWeight(context, searcher);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java
index 591aa2c..6b587de 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiFunction.java
@@ -112,7 +112,7 @@ public abstract class MultiFunction extends ValueSource {
     return sb.toString();
   }
 
-  public static FunctionValues[] valsArr(List<ValueSource> sources, Map fcontext, LeafReaderContext readerContext) throws IOException {
+  public static FunctionValues[] valsArr(List<ValueSource> sources, Map<Object, Object> fcontext, LeafReaderContext readerContext) throws IOException {
     final FunctionValues[] valsArr = new FunctionValues[sources.size()];
     int i=0;
     for (ValueSource source : sources) {
@@ -157,7 +157,7 @@ public abstract class MultiFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     for (ValueSource source : sources)
       source.createWeight(context, searcher);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedDoubleFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedDoubleFieldSource.java
index b0728cf..4895d5b 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedDoubleFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedDoubleFieldSource.java
@@ -55,7 +55,7 @@ public class MultiValuedDoubleFieldSource extends DoubleFieldSource {
   }
   
   @Override
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field);
     return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.DOUBLE);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedFloatFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedFloatFieldSource.java
index af8eacf..bedae04 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedFloatFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedFloatFieldSource.java
@@ -55,7 +55,7 @@ public class MultiValuedFloatFieldSource extends FloatFieldSource {
   }
   
   @Override
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field);
     return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.FLOAT);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedIntFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedIntFieldSource.java
index 3110f8d..da14032 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedIntFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedIntFieldSource.java
@@ -55,7 +55,7 @@ public class MultiValuedIntFieldSource extends IntFieldSource {
   }
   
   @Override
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field);
     return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.INT);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedLongFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedLongFieldSource.java
index 5e31e13..8c0f17d 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedLongFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MultiValuedLongFieldSource.java
@@ -55,7 +55,7 @@ public class MultiValuedLongFieldSource extends LongFieldSource {
   }
   
   @Override
-  protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException {
+  protected NumericDocValues getNumericDocValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field);
     return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.LONG);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NormValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NormValueSource.java
index ffbb0c5..9f81dc4 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NormValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NormValueSource.java
@@ -55,12 +55,12 @@ public class NormValueSource extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     context.put("searcher",searcher);
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     final TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), field);
     if (similarity == null) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NumDocsValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NumDocsValueSource.java
index 21e881d..2e5a667 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NumDocsValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/NumDocsValueSource.java
@@ -41,7 +41,7 @@ public class NumDocsValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     // Searcher has no numdocs so we must use the reader instead
     return new DocFreqValueSource.ConstIntDocValues(ReaderUtil.getTopLevelContext(readerContext).reader().numDocs(), this);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java
index 81d3bba..d828010 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/QueryValueSource.java
@@ -55,7 +55,7 @@ public class QueryValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map fcontext, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> fcontext, LeafReaderContext readerContext) throws IOException {
     return new QueryDocValues(this, readerContext, fcontext);
   }
 
@@ -72,7 +72,7 @@ public class QueryValueSource extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     Query rewritten = searcher.rewrite(q);
     Weight w = searcher.createWeight(rewritten, ScoreMode.COMPLETE, 1);
     context.put(this, w);
@@ -84,7 +84,7 @@ class QueryDocValues extends FloatDocValues {
   final LeafReaderContext readerContext;
   final Weight weight;
   final float defVal;
-  final Map fcontext;
+  final Map<Object, Object> fcontext;
   final Query q;
 
   Scorer scorer;
@@ -96,7 +96,7 @@ class QueryDocValues extends FloatDocValues {
   int lastDocRequested=-1;
 
 
-  public QueryDocValues(QueryValueSource vs, LeafReaderContext readerContext, Map fcontext) throws IOException {
+  public QueryDocValues(QueryValueSource vs, LeafReaderContext readerContext, Map<Object, Object> fcontext) throws IOException {
     super(vs);
 
     this.readerContext = readerContext;
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/RangeMapFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/RangeMapFloatFunction.java
index 5492c7f..d924189 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/RangeMapFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/RangeMapFloatFunction.java
@@ -58,7 +58,7 @@ public class RangeMapFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues vals =  source.getValues(context, readerContext);
     final FunctionValues targets = target.getValues(context, readerContext);
     final FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
@@ -76,7 +76,7 @@ public class RangeMapFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ReciprocalFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ReciprocalFloatFunction.java
index d6b050e..f59d9e7 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ReciprocalFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ReciprocalFloatFunction.java
@@ -60,7 +60,7 @@ public class ReciprocalFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues vals = source.getValues(context, readerContext);
     return new FloatDocValues(this) {
       @Override
@@ -81,7 +81,7 @@ public class ReciprocalFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ScaleFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ScaleFloatFunction.java
index 38bd86a..bb465b4 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ScaleFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ScaleFloatFunction.java
@@ -59,7 +59,7 @@ public class ScaleFloatFunction extends ValueSource {
     float maxVal;
   }
 
-  private ScaleInfo createScaleInfo(Map context, LeafReaderContext readerContext) throws IOException {
+  private ScaleInfo createScaleInfo(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final List<LeafReaderContext> leaves = ReaderUtil.getTopLevelContext(readerContext).leaves();
 
     float minVal = Float.POSITIVE_INFINITY;
@@ -100,7 +100,7 @@ public class ScaleFloatFunction extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
 
     ScaleInfo scaleInfo = (ScaleInfo)context.get(ScaleFloatFunction.this);
     if (scaleInfo == null) {
@@ -133,7 +133,7 @@ public class ScaleFloatFunction extends ValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java
index d9ad8c4..2bb5e3f 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleBoolFunction.java
@@ -44,7 +44,7 @@ public abstract class SimpleBoolFunction extends BoolFunction {
   protected abstract boolean func(int doc, FunctionValues vals) throws IOException;
 
   @Override
-  public BoolDocValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public BoolDocValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues vals =  source.getValues(context, readerContext);
     return new BoolDocValues(this) {
       @Override
@@ -76,7 +76,7 @@ public abstract class SimpleBoolFunction extends BoolFunction {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleFloatFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleFloatFunction.java
index f74f8e4..76aac62 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleFloatFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SimpleFloatFunction.java
@@ -34,7 +34,7 @@ import java.util.Map;
   protected abstract float func(int doc, FunctionValues vals) throws IOException;
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final FunctionValues vals =  source.getValues(context, readerContext);
     return new FloatDocValues(this) {
       @Override
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SingleFunction.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SingleFunction.java
index f7eb699..f862845 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SingleFunction.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SingleFunction.java
@@ -52,7 +52,7 @@ import java.util.Map;
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     source.createWeight(context, searcher);
   }
 }
\ No newline at end of file
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SortedSetFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SortedSetFieldSource.java
index ddf7129..e9a3358 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SortedSetFieldSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SortedSetFieldSource.java
@@ -55,7 +55,7 @@ public class SortedSetFieldSource extends FieldCacheSource {
   }
   
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     SortedSetDocValues sortedSet = DocValues.getSortedSet(readerContext.reader(), field);
     SortedDocValues view = SortedSetSelector.wrap(sortedSet, selector);
     return new DocTermsIndexDocValues(this, view) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SumTotalTermFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SumTotalTermFreqValueSource.java
index 716d304..031d2c0 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SumTotalTermFreqValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/SumTotalTermFreqValueSource.java
@@ -48,12 +48,12 @@ public class SumTotalTermFreqValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return (FunctionValues)context.get(this);
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     long sumTotalTermFreq = 0;
     for (LeafReaderContext readerContext : searcher.getTopReaderContext().leaves()) {
       Terms terms = readerContext.reader().terms(indexedField);
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
index 731ab1f..f127b2f 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
@@ -48,7 +48,7 @@ public class TFValueSource extends TermFreqValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final Terms terms = readerContext.reader().terms(indexedField);
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     final TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), indexedField);
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
index 55c54f5..78ca5ac 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
@@ -46,7 +46,7 @@ public class TermFreqValueSource extends DocFreqValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     final Terms terms = readerContext.reader().terms(indexedField);
 
     return new IntDocValues(this) {
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TotalTermFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TotalTermFreqValueSource.java
index 5a69e42..c7eb02f 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TotalTermFreqValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TotalTermFreqValueSource.java
@@ -55,12 +55,12 @@ public class TotalTermFreqValueSource extends ValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     return (FunctionValues)context.get(this);
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     long totalTermFreq = 0;
     for (LeafReaderContext readerContext : searcher.getTopReaderContext().leaves()) {
       long val = readerContext.reader().totalTermFreq(new Term(indexedField, indexedBytes));
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/VectorValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/VectorValueSource.java
index 768243a..8ca99ca 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/VectorValueSource.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/VectorValueSource.java
@@ -52,7 +52,7 @@ public class VectorValueSource extends MultiValueSource {
   }
 
   @Override
-  public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
+  public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException {
     int size = sources.size();
 
     // special-case x,y and lat,lon since it's so common
@@ -178,7 +178,7 @@ public class VectorValueSource extends MultiValueSource {
   }
 
   @Override
-  public void createWeight(Map context, IndexSearcher searcher) throws IOException {
+  public void createWeight(Map<Object, Object> context, IndexSearcher searcher) throws IOException {
     for (ValueSource source : sources)
       source.createWeight(context, searcher);
   }
diff --git a/lucene/queries/src/java/org/apache/lucene/queries/intervals/IntervalMatches.java b/lucene/queries/src/java/org/apache/lucene/queries/intervals/IntervalMatches.java
index 82d9d09..15448e9 100644
--- a/lucene/queries/src/java/org/apache/lucene/queries/intervals/IntervalMatches.java
+++ b/lucene/queries/src/java/org/apache/lucene/queries/intervals/IntervalMatches.java
@@ -163,6 +163,7 @@ final class IntervalMatches {
           case ITERATING:
           case NO_MORE_INTERVALS:
             state = State.EXHAUSTED;
+            break;
           case EXHAUSTED:
         }
         return NO_MORE_DOCS;
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
index a75cc66..46ba04b 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
@@ -565,7 +565,7 @@ public class TestValueSources extends LuceneTestCase {
     
     // actual doc / index is not relevant for this test
     final LeafReaderContext leaf = searcher.getIndexReader().leaves().get(0);
-    final Map context = ValueSource.newContext(searcher);
+    final Map<Object, Object> context = ValueSource.newContext(searcher);
 
     ALL_EXIST_VS.createWeight(context, searcher);
     NONE_EXIST_VS.createWeight(context, searcher);
@@ -643,12 +643,12 @@ public class TestValueSources extends LuceneTestCase {
     assertExists(NONE_EXIST_VS, vs);
   }
   /**
-   * Asserts that for every doc, the {@link FunctionValues#exists} value from the 
-   * <code>actual</code> {@link ValueSource} matches the {@link FunctionValues#exists} 
+   * Asserts that for every doc, the {@link FunctionValues#exists} value from the
+   * <code>actual</code> {@link ValueSource} matches the {@link FunctionValues#exists}
    * value from the <code>expected</code> {@link ValueSource}
    */
   void assertExists(ValueSource expected, ValueSource actual) {
-    Map context = ValueSource.newContext(searcher);
+    Map<Object, Object> context = ValueSource.newContext(searcher);
     try {
       expected.createWeight(context, searcher);
       actual.createWeight(context, searcher);
@@ -712,7 +712,7 @@ public class TestValueSources extends LuceneTestCase {
     }
     
     @Override
-    public FunctionValues getValues(Map context, LeafReaderContext readerContext) {
+    public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) {
       return new FloatDocValues(this) {
         @Override
         public float floatVal(int doc) {
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
index 6f95c5b..7e1e065 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleServer.java
@@ -220,6 +220,7 @@ public class SimpleServer extends LuceneTestCase {
     return new CopyState(files, version, gen, infosBytes, completedMergeFiles, primaryGen, null);
   }
 
+  @SuppressWarnings("try")
   public void test() throws Exception {
 
     int id = Integer.parseInt(System.getProperty("tests.nrtreplication.nodeid"));
diff --git a/lucene/sandbox/src/java/org/apache/lucene/search/PhraseWildcardQuery.java b/lucene/sandbox/src/java/org/apache/lucene/search/PhraseWildcardQuery.java
index 16c601a..e348b62 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/search/PhraseWildcardQuery.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/search/PhraseWildcardQuery.java
@@ -858,7 +858,7 @@ public class PhraseWildcardQuery extends Query {
     @SuppressWarnings("unchecked")
     protected void setTermStatesForSegment(LeafReaderContext leafReaderContext, List<TermBytesTermState> termStates) {
       if (termStatesPerSegment == null) {
-        termStatesPerSegment = (List<TermBytesTermState>[]) new List[numSegments];
+        termStatesPerSegment = (List<TermBytesTermState>[]) new List<?>[numSegments];
         termsData.numTermsMatching++;
       }
       termStatesPerSegment[leafReaderContext.ord] = termStates;
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/SpatialStrategy.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/SpatialStrategy.java
index bd23a36..06efda9 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/SpatialStrategy.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/SpatialStrategy.java
@@ -136,7 +136,7 @@ public abstract class SpatialStrategy {
   public final DoubleValuesSource makeRecipDistanceValueSource(Shape queryShape) {
     Rectangle bbox = queryShape.getBoundingBox();
     double diagonalDist = ctx.getDistCalc().distance(
-        ctx.makePoint(bbox.getMinX(), bbox.getMinY()), bbox.getMaxX(), bbox.getMaxY());
+        ctx.getShapeFactory().pointXY(bbox.getMinX(), bbox.getMinY()), bbox.getMaxX(), bbox.getMaxY());
     double distToEdge = diagonalDist * 0.5;
     float c = (float)distToEdge * 0.1f;//one tenth
     DoubleValuesSource distance = makeDistanceValueSource(queryShape.getCenter(), 1.0);
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxValueSource.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxValueSource.java
index 1a2525e..0a84879 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxValueSource.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxValueSource.java
@@ -54,7 +54,7 @@ class BBoxValueSource extends ShapeValuesSource {
     final NumericDocValues maxY = DocValues.getNumeric(reader, strategy.field_maxY);
 
     //reused
-    final Rectangle rect = strategy.getSpatialContext().makeRectangle(0,0,0,0);
+    final Rectangle rect = strategy.getSpatialContext().getShapeFactory().rect(0,0,0,0);
 
     return new ShapeValues() {
 
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/HeatmapFacetCounter.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/HeatmapFacetCounter.java
index 6c5253e..5402dd5 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/HeatmapFacetCounter.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/HeatmapFacetCounter.java
@@ -100,7 +100,7 @@ public class HeatmapFacetCounter {
     //First get the rect of the cell at the bottom-left at depth facetLevel
     final SpatialPrefixTree grid = strategy.getGrid();
     final SpatialContext ctx = grid.getSpatialContext();
-    final Point cornerPt = ctx.makePoint(inputRect.getMinX(), inputRect.getMinY());
+    final Point cornerPt = ctx.getShapeFactory().pointXY(inputRect.getMinX(), inputRect.getMinY());
     final CellIterator cellIterator = grid.getTreeCellIterator(cornerPt, facetLevel);
     Cell cornerCell = null;
     while (cellIterator.hasNext()) {
@@ -141,7 +141,7 @@ public class HeatmapFacetCounter {
       heatMaxY = worldRect.getMaxY();
     }
 
-    final Heatmap heatmap = new Heatmap(columns, rows, ctx.makeRectangle(heatMinX, heatMaxX, heatMinY, heatMaxY));
+    final Heatmap heatmap = new Heatmap(columns, rows, ctx.getShapeFactory().rect(heatMinX, heatMaxX, heatMinY, heatMaxY));
     if (topAcceptDocs instanceof Bits.MatchNoBits) {
       return heatmap; // short-circuit
     }
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeQuery.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeQuery.java
index f595f0e..538fc7d 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeQuery.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/WithinPrefixTreeQuery.java
@@ -107,13 +107,13 @@ public class WithinPrefixTreeQuery extends AbstractVisitingPrefixTreeQuery {
       throw new IllegalArgumentException("distErr must be > 0");
     SpatialContext ctx = grid.getSpatialContext();
     if (shape instanceof Point) {
-      return ctx.makeCircle((Point)shape, distErr);
+      return ctx.getShapeFactory().circle((Point)shape, distErr);
     } else if (shape instanceof Circle) {
       Circle circle = (Circle) shape;
       double newDist = circle.getRadius() + distErr;
       if (ctx.isGeo() && newDist > 180)
         newDist = 180;
-      return ctx.makeCircle(circle.getCenter(), newDist);
+      return ctx.getShapeFactory().circle(circle.getCenter(), newDist);
     } else {
       Rectangle bbox = shape.getBoundingBox();
       double newMinX = bbox.getMinX() - distErr;
@@ -139,7 +139,7 @@ public class WithinPrefixTreeQuery extends AbstractVisitingPrefixTreeQuery {
         newMinY = Math.max(newMinY, ctx.getWorldBounds().getMinY());
         newMaxY = Math.min(newMaxY, ctx.getWorldBounds().getMaxY());
       }
-      return ctx.makeRectangle(newMinX, newMaxX, newMinY, newMaxY);
+      return ctx.getShapeFactory().rect(newMinX, newMaxX, newMinY, newMaxY);
     }
   }
 
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/PackedQuadPrefixTree.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/PackedQuadPrefixTree.java
index a7174a4..dbb4054 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/PackedQuadPrefixTree.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/PackedQuadPrefixTree.java
@@ -62,7 +62,9 @@ public class PackedQuadPrefixTree extends QuadPrefixTree {
     @Override
     protected SpatialPrefixTree newSPT() {
       PackedQuadPrefixTree tree = new PackedQuadPrefixTree(ctx, maxLevels != null ? maxLevels : MAX_LEVELS_POSSIBLE);
-      tree.robust = getVersion().onOrAfter(Version.LUCENE_8_3_0);
+      @SuppressWarnings("deprecation")
+      Version lucene830 = Version.LUCENE_8_3_0;
+      tree.robust = getVersion().onOrAfter(lucene830);
       return tree;
     }
   }
@@ -88,7 +90,7 @@ public class PackedQuadPrefixTree extends QuadPrefixTree {
   public Cell getCell(Point p, int level) {
     if (!robust) { // old method
       List<Cell> cells = new ArrayList<>(1);
-      buildNotRobustly(xmid, ymid, 0, cells, 0x0L, ctx.makePoint(p.getX(), p.getY()), level);
+      buildNotRobustly(xmid, ymid, 0, cells, 0x0L, ctx.getShapeFactory().pointXY(p.getX(), p.getY()), level);
       if (!cells.isEmpty()) {
         return cells.get(0);//note cells could be longer if p on edge
       }
@@ -152,7 +154,7 @@ public class PackedQuadPrefixTree extends QuadPrefixTree {
     double w = levelW[level] / 2;
     double h = levelH[level] / 2;
 
-    SpatialRelation v = shape.relate(ctx.makeRectangle(cx - w, cx + w, cy - h, cy + h));
+    SpatialRelation v = shape.relate(ctx.getShapeFactory().rect(cx - w, cx + w, cy - h, cy + h));
 
     if (SpatialRelation.DISJOINT == v) {
       return;
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/QuadPrefixTree.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/QuadPrefixTree.java
index e060302..d1407e1 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/QuadPrefixTree.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/QuadPrefixTree.java
@@ -53,7 +53,9 @@ public class QuadPrefixTree extends LegacyPrefixTree {
     protected SpatialPrefixTree newSPT() {
       QuadPrefixTree tree = new QuadPrefixTree(ctx,
           maxLevels != null ? maxLevels : MAX_LEVELS_POSSIBLE);
-      tree.robust = getVersion().onOrAfter(Version.LUCENE_8_3_0);
+      @SuppressWarnings("deprecation")
+      Version LUCENE_8_3_0 = Version.LUCENE_8_3_0;
+      tree.robust = getVersion().onOrAfter(LUCENE_8_3_0);
       return tree;
     }
   }
@@ -142,7 +144,7 @@ public class QuadPrefixTree extends LegacyPrefixTree {
   public Cell getCell(Point p, int level) {
     if (!robust) { // old method
       List<Cell> cells = new ArrayList<>(1);
-      buildNotRobustly(xmid, ymid, 0, cells, new BytesRef(maxLevels+1), ctx.makePoint(p.getX(),p.getY()), level);
+      buildNotRobustly(xmid, ymid, 0, cells, new BytesRef(maxLevels+1), ctx.getShapeFactory().pointXY(p.getX(),p.getY()), level);
       if (!cells.isEmpty()) {
         return cells.get(0);//note cells could be longer if p on edge
       }
@@ -223,7 +225,7 @@ public class QuadPrefixTree extends LegacyPrefixTree {
     double h = levelH[level] / 2;
 
     int strlen = str.length;
-    Rectangle rectangle = ctx.makeRectangle(cx - w, cx + w, cy - h, cy + h);
+    Rectangle rectangle = ctx.getShapeFactory().rect(cx - w, cx + w, cy - h, cy + h);
     SpatialRelation v = shape.relate(rectangle);
     if (SpatialRelation.CONTAINS == v) {
       str.bytes[str.length++] = (byte)c;//append
@@ -354,7 +356,7 @@ public class QuadPrefixTree extends LegacyPrefixTree {
         width = gridW;
         height = gridH;
       }
-      return ctx.makeRectangle(xmin, xmin + width, ymin, ymin + height);
+      return ctx.getShapeFactory().rect(xmin, xmin + width, ymin, ymin + height);
     }
   }//QuadCell
 }
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/spatial4j/Geo3dShapeFactory.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/spatial4j/Geo3dShapeFactory.java
index 071c775..ee30d62 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/spatial4j/Geo3dShapeFactory.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/spatial4j/Geo3dShapeFactory.java
@@ -197,6 +197,7 @@ public class Geo3dShapeFactory implements S2ShapeFactory {
   }
 
   @Override
+  @SuppressWarnings("deprecation")
   public Shape lineString(List<Point> list, double distance) {
     LineStringBuilder builder = lineString();
     for (Point point : list) {
@@ -207,6 +208,7 @@ public class Geo3dShapeFactory implements S2ShapeFactory {
   }
 
   @Override
+  @SuppressWarnings("deprecation")
   public <S extends Shape> ShapeCollection<S> multiShape(List<S> list) {
     throw new UnsupportedOperationException();
   }
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java
index 989252e..97c1583 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java
@@ -35,6 +35,7 @@ import org.junit.Test;
 import org.locationtech.spatial4j.context.SpatialContext;
 import org.locationtech.spatial4j.shape.Point;
 import org.locationtech.spatial4j.shape.Shape;
+import org.locationtech.spatial4j.shape.ShapeFactory;
 
 public class DistanceStrategyTest extends StrategyTestCase {
   @ParametersFactory(argumentFormatting = "strategy=%s")
@@ -81,20 +82,21 @@ public class DistanceStrategyTest extends StrategyTestCase {
 
   @Test
   public void testDistanceOrder() throws IOException {
-    adoc("100", ctx.makePoint(2, 1));
-    adoc("101", ctx.makePoint(-1, 4));
+    ShapeFactory shapeFactory = ctx.getShapeFactory();
+    adoc("100", shapeFactory.pointXY(2, 1));
+    adoc("101", shapeFactory.pointXY(-1, 4));
     adoc("103", (Shape)null);//test score for nothing
     commit();
     //FYI distances are in docid order
-    checkDistValueSource(ctx.makePoint(4, 3), 2.8274937f, 5.0898066f, 180f);
-    checkDistValueSource(ctx.makePoint(0, 4), 3.6043684f, 0.9975641f, 180f);
+    checkDistValueSource(shapeFactory.pointXY(4, 3), 2.8274937f, 5.0898066f, 180f);
+    checkDistValueSource(shapeFactory.pointXY(0, 4), 3.6043684f, 0.9975641f, 180f);
   }
 
   @Test
   public void testRecipScore() throws IOException {
-    Point p100 = ctx.makePoint(2.02, 0.98);
+    Point p100 = ctx.getShapeFactory().pointXY(2.02, 0.98);
     adoc("100", p100);
-    Point p101 = ctx.makePoint(-1.001, 4.001);
+    Point p101 = ctx.getShapeFactory().pointXY(-1.001, 4.001);
     adoc("101", p101);
     adoc("103", (Shape)null);//test score for nothing
     commit();
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/PortedSolr3Test.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/PortedSolr3Test.java
index e9cd63d..244aae7 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/PortedSolr3Test.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/PortedSolr3Test.java
@@ -36,12 +36,15 @@ import org.locationtech.spatial4j.context.SpatialContext;
 import org.locationtech.spatial4j.distance.DistanceUtils;
 import org.locationtech.spatial4j.shape.Point;
 import org.locationtech.spatial4j.shape.Shape;
+import org.locationtech.spatial4j.shape.ShapeFactory;
 
 /**
  * Based off of Solr 3's SpatialFilterTest.
  */
 public class PortedSolr3Test extends StrategyTestCase {
 
+  private ShapeFactory shapeFactory;
+
   @ParametersFactory(argumentFormatting = "strategy=%s")
   public static Iterable<Object[]> parameters() {
     List<Object[]> ctorArgs = new ArrayList<>();
@@ -74,23 +77,24 @@ public class PortedSolr3Test extends StrategyTestCase {
   public PortedSolr3Test(String suiteName, SpatialStrategy strategy) {
     this.ctx = strategy.getSpatialContext();
     this.strategy = strategy;
+    shapeFactory = ctx.getShapeFactory();
   }
 
   private void setupDocs() throws Exception {
     super.deleteAll();
-    adoc("1", ctx.makePoint(-79.9289094, 32.7693246));
-    adoc("2", ctx.makePoint(-80.9289094, 33.7693246));
-    adoc("3", ctx.makePoint(50.9289094, -32.7693246));
-    adoc("4", ctx.makePoint(60.9289094, -50.7693246));
-    adoc("5", ctx.makePoint(0, 0));
-    adoc("6", ctx.makePoint(0.1, 0.1));
-    adoc("7", ctx.makePoint(-0.1, -0.1));
-    adoc("8", ctx.makePoint(179.9, 0));
-    adoc("9", ctx.makePoint(-179.9, 0));
-    adoc("10", ctx.makePoint(50, 89.9));
-    adoc("11", ctx.makePoint(-130, 89.9));
-    adoc("12", ctx.makePoint(50, -89.9));
-    adoc("13", ctx.makePoint(-130, -89.9));
+    adoc("1", shapeFactory.pointXY(-79.9289094, 32.7693246));
+    adoc("2", shapeFactory.pointXY(-80.9289094, 33.7693246));
+    adoc("3", shapeFactory.pointXY(50.9289094, -32.7693246));
+    adoc("4", shapeFactory.pointXY(60.9289094, -50.7693246));
+    adoc("5", shapeFactory.pointXY(0, 0));
+    adoc("6", shapeFactory.pointXY(0.1, 0.1));
+    adoc("7", shapeFactory.pointXY(-0.1, -0.1));
+    adoc("8", shapeFactory.pointXY(179.9, 0));
+    adoc("9", shapeFactory.pointXY(-179.9, 0));
+    adoc("10", shapeFactory.pointXY(50, 89.9));
+    adoc("11", shapeFactory.pointXY(-130, 89.9));
+    adoc("12", shapeFactory.pointXY(50, -89.9));
+    adoc("13", shapeFactory.pointXY(-130, -89.9));
     commit();
   }
 
@@ -100,39 +104,39 @@ public class PortedSolr3Test extends StrategyTestCase {
     setupDocs();
     //Try some edge cases
       //NOTE: 2nd arg is distance in kilometers
-    checkHitsCircle(ctx.makePoint(1, 1), 175, 3, 5, 6, 7);
-    checkHitsCircle(ctx.makePoint(179.8, 0), 200, 2, 8, 9);
-    checkHitsCircle(ctx.makePoint(50, 89.8), 200, 2, 10, 11);//this goes over the north pole
-    checkHitsCircle(ctx.makePoint(50, -89.8), 200, 2, 12, 13);//this goes over the south pole
+    checkHitsCircle(shapeFactory.pointXY(1, 1), 175, 3, 5, 6, 7);
+    checkHitsCircle(shapeFactory.pointXY(179.8, 0), 200, 2, 8, 9);
+    checkHitsCircle(shapeFactory.pointXY(50, 89.8), 200, 2, 10, 11);//this goes over the north pole
+    checkHitsCircle(shapeFactory.pointXY(50, -89.8), 200, 2, 12, 13);//this goes over the south pole
     //try some normal cases
-    checkHitsCircle(ctx.makePoint(-80.0, 33.0), 300, 2);
+    checkHitsCircle(shapeFactory.pointXY(-80.0, 33.0), 300, 2);
     //large distance
-    checkHitsCircle(ctx.makePoint(1, 1), 5000, 3, 5, 6, 7);
+    checkHitsCircle(shapeFactory.pointXY(1, 1), 5000, 3, 5, 6, 7);
     //Because we are generating a box based on the west/east longitudes and the south/north latitudes, which then
     //translates to a range query, which is slightly more inclusive.  Thus, even though 0.0 is 15.725 kms away,
     //it will be included, b/zScaling of the box calculation.
-    checkHitsBBox(ctx.makePoint(0.1, 0.1), 15, 2, 5, 6);
+    checkHitsBBox(shapeFactory.pointXY(0.1, 0.1), 15, 2, 5, 6);
     //try some more
     deleteAll();
-    adoc("14", ctx.makePoint(5, 0));
-    adoc("15", ctx.makePoint(15, 0));
+    adoc("14", shapeFactory.pointXY(5, 0));
+    adoc("15", shapeFactory.pointXY(15, 0));
     //3000KM from 0,0, see http://www.movable-type.co.uk/scripts/latlong.html
-    adoc("16", ctx.makePoint(19.79750, 18.71111));
-    adoc("17", ctx.makePoint(-95.436643, 44.043900));
+    adoc("16", shapeFactory.pointXY(19.79750, 18.71111));
+    adoc("17", shapeFactory.pointXY(-95.436643, 44.043900));
     commit();
 
-    checkHitsCircle(ctx.makePoint(0, 0), 1000, 1, 14);
-    checkHitsCircle(ctx.makePoint(0, 0), 2000, 2, 14, 15);
-    checkHitsBBox(ctx.makePoint(0, 0), 3000, 3, 14, 15, 16);
-    checkHitsCircle(ctx.makePoint(0, 0), 3001, 3, 14, 15, 16);
-    checkHitsCircle(ctx.makePoint(0, 0), 3000.1, 3, 14, 15, 16);
+    checkHitsCircle(shapeFactory.pointXY(0, 0), 1000, 1, 14);
+    checkHitsCircle(shapeFactory.pointXY(0, 0), 2000, 2, 14, 15);
+    checkHitsBBox(shapeFactory.pointXY(0, 0), 3000, 3, 14, 15, 16);
+    checkHitsCircle(shapeFactory.pointXY(0, 0), 3001, 3, 14, 15, 16);
+    checkHitsCircle(shapeFactory.pointXY(0, 0), 3000.1, 3, 14, 15, 16);
 
     //really fine grained distance and reflects some of the vagaries of how we are calculating the box
-    checkHitsCircle(ctx.makePoint(-96.789603, 43.517030), 109, 0);
+    checkHitsCircle(shapeFactory.pointXY(-96.789603, 43.517030), 109, 0);
 
     // falls outside of the real distance, but inside the bounding box
-    checkHitsCircle(ctx.makePoint(-96.789603, 43.517030), 110, 0);
-    checkHitsBBox(ctx.makePoint(-96.789603, 43.517030), 110, 1, 17);
+    checkHitsCircle(shapeFactory.pointXY(-96.789603, 43.517030), 110, 0);
+    checkHitsBBox(shapeFactory.pointXY(-96.789603, 43.517030), 110, 1, 17);
   }
 
   //---- these are similar to Solr test methods
@@ -147,7 +151,7 @@ public class PortedSolr3Test extends StrategyTestCase {
   private void _checkHits(boolean bbox, Point pt, double distKM, int assertNumFound, int... assertIds) {
     SpatialOperation op = SpatialOperation.Intersects;
     double distDEG = DistanceUtils.dist2Degrees(distKM, DistanceUtils.EARTH_MEAN_RADIUS_KM);
-    Shape shape = ctx.makeCircle(pt, distDEG);
+    Shape shape = shapeFactory.circle(pt, distDEG);
     if (bbox)
       shape = shape.getBoundingBox();
 
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/QueryEqualsHashCodeTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/QueryEqualsHashCodeTest.java
index f52ef2b..53da280 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/QueryEqualsHashCodeTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/QueryEqualsHashCodeTest.java
@@ -103,12 +103,12 @@ public class QueryEqualsHashCodeTest extends LuceneTestCase {
   }
 
   private SpatialArgs makeArgs1() {
-    final Shape shape1 = ctx.makeRectangle(0, 0, 10, 10);
+    final Shape shape1 = ctx.getShapeFactory().rect(0, 0, 10, 10);
     return new SpatialArgs(predicate, shape1);
   }
 
   private SpatialArgs makeArgs2() {
-    final Shape shape2 = ctx.makeRectangle(0, 0, 20, 20);
+    final Shape shape2 = ctx.getShapeFactory().rect(0, 0, 20, 20);
     return new SpatialArgs(predicate, shape2);
   }
 
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
index f810ab7..f01c819 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
@@ -108,14 +108,14 @@ public class SpatialExample extends LuceneTestCase {
 
     //Spatial4j is x-y order for arguments
     indexWriter.addDocument(newSampleDocument(
-        2, ctx.makePoint(-80.93, 33.77)));
+        2, ctx.getShapeFactory().pointXY(-80.93, 33.77)));
 
     //Spatial4j has a WKT parser which is also "x y" order
     indexWriter.addDocument(newSampleDocument(
         4, ctx.readShapeFromWkt("POINT(60.9289094 -50.7693246)")));
 
     indexWriter.addDocument(newSampleDocument(
-        20, ctx.makePoint(0.1,0.1), ctx.makePoint(0, 0)));
+        20, ctx.getShapeFactory().pointXY(0.1,0.1), ctx.getShapeFactory().pointXY(0, 0)));
 
     indexWriter.close();
   }
@@ -149,7 +149,7 @@ public class SpatialExample extends LuceneTestCase {
       //Search with circle
       //note: SpatialArgs can be parsed from a string
       SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects,
-          ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(200, DistanceUtils.EARTH_MEAN_RADIUS_KM)));
+          ctx.getShapeFactory().circle(-80.0, 33.0, DistanceUtils.dist2Degrees(200, DistanceUtils.EARTH_MEAN_RADIUS_KM)));
       Query query = strategy.makeQuery(args);
       TopDocs docs = indexSearcher.search(query, 10, idSort);
       assertDocMatchedIds(indexSearcher, docs, 2);
@@ -168,7 +168,7 @@ public class SpatialExample extends LuceneTestCase {
     }
     //--Match all, order by distance ascending
     {
-      Point pt = ctx.makePoint(60, -50);
+      Point pt = ctx.getShapeFactory().pointXY(60, -50);
       DoubleValuesSource valueSource = strategy.makeDistanceValueSource(pt, DistanceUtils.DEG_TO_KM);//the distance (in km)
       Sort distSort = new Sort(valueSource.getSortField(false)).rewrite(indexSearcher);//false=asc dist
       TopDocs docs = indexSearcher.search(new MatchAllDocsQuery(), 10, distSort);
@@ -183,7 +183,7 @@ public class SpatialExample extends LuceneTestCase {
     //demo arg parsing
     {
       SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects,
-          ctx.makeCircle(-80.0, 33.0, 1));
+          ctx.getShapeFactory().circle(-80.0, 33.0, 1));
       SpatialArgs args2 = new SpatialArgsParser().parse("Intersects(BUFFER(POINT(-80 33),1))", ctx);
       assertEquals(args.toString(),args2.toString());
     }
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
index 55ad1d7..e875ee2 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
@@ -41,7 +41,6 @@ import org.locationtech.spatial4j.shape.Rectangle;
 
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomDouble;
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomGaussian;
-import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween;
 
 /** A base test class for spatial lucene. It's mostly Lucene generic. */
@@ -121,7 +120,7 @@ public abstract class SpatialTestCase extends LuceneTestCase {
 
   protected Point randomPoint() {
     final Rectangle WB = ctx.getWorldBounds();
-    return ctx.makePoint(
+    return ctx.getShapeFactory().pointXY(
         randomIntBetween((int) WB.getMinX(), (int) WB.getMaxX()),
         randomIntBetween((int) WB.getMinY(), (int) WB.getMaxY()));
   }
@@ -143,7 +142,7 @@ public abstract class SpatialTestCase extends LuceneTestCase {
     double yMin = yNewStartAndHeight[0];
     double yMax = yMin + yNewStartAndHeight[1];
 
-    return ctx.makeRectangle(xMin, xMax, yMin, yMax);
+    return ctx.getShapeFactory().rect(xMin, xMax, yMin, yMax);
   }
 
   /** Returns new minStart and new length that is inside the range specified by the arguments. */
@@ -154,7 +153,7 @@ public abstract class SpatialTestCase extends LuceneTestCase {
       int intBoundEnd = (int) (boundStart + boundLen);
       int intBoundLen = intBoundEnd - intBoundStart;
       int newLen = (int) randomGaussianMeanMax(intBoundLen / 16.0, intBoundLen);
-      int newStart = intBoundStart + randomInt(intBoundLen - newLen);
+      int newStart = intBoundStart + randomIntBetween(0, intBoundLen - newLen);
       return new double[]{newStart, newLen};
     } else { // (no int rounding)
       double newLen = randomGaussianMeanMax(boundLen / 16, boundLen);
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java
index 3a94bf0..bca89b5 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java
@@ -52,12 +52,12 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
     if (ctx.isGeo() && (deltaLeft != 0 || deltaRight != 0)) {
       //if geo & doesn't world-wrap, we shift randomly to potentially cross dateline
       int shift = nextIntInclusive(360);
-      return ctx.makeRectangle(
+      return ctx.getShapeFactory().rect(
           DistanceUtils.normLonDEG(world.getMinX() + deltaLeft + shift),
           DistanceUtils.normLonDEG(world.getMaxX() - deltaRight + shift),
           world.getMinY() + deltaBottom, world.getMaxY() - deltaTop);
     } else {
-      return ctx.makeRectangle(
+      return ctx.getShapeFactory().rect(
           world.getMinX() + deltaLeft, world.getMaxX() - deltaRight,
           world.getMinY() + deltaBottom, world.getMaxY() - deltaTop);
     }
@@ -110,45 +110,45 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
   public void testIntersectsBugDatelineEdge() throws IOException {
     setupGeo();
     testOperation(
-        ctx.makeRectangle(160, 180, -10, 10),
+        ctx.getShapeFactory().rect(160, 180, -10, 10),
         SpatialOperation.Intersects,
-        ctx.makeRectangle(-180, -160, -10, 10), true);
+        ctx.getShapeFactory().rect(-180, -160, -10, 10), true);
   }
 
   @Test
   public void testIntersectsWorldDatelineEdge() throws IOException {
     setupGeo();
     testOperation(
-        ctx.makeRectangle(-180, 180, -10, 10),
+        ctx.getShapeFactory().rect(-180, 180, -10, 10),
         SpatialOperation.Intersects,
-        ctx.makeRectangle(180, 180, -10, 10), true);
+        ctx.getShapeFactory().rect(180, 180, -10, 10), true);
   }
 
   @Test
   public void testWithinBugDatelineEdge() throws IOException {
     setupGeo();
     testOperation(
-        ctx.makeRectangle(180, 180, -10, 10),
+        ctx.getShapeFactory().rect(180, 180, -10, 10),
         SpatialOperation.IsWithin,
-        ctx.makeRectangle(-180, -100, -10, 10), true);
+        ctx.getShapeFactory().rect(-180, -100, -10, 10), true);
   }
 
   @Test
   public void testContainsBugDatelineEdge() throws IOException {
     setupGeo();
     testOperation(
-        ctx.makeRectangle(-180, -150, -10, 10),
+        ctx.getShapeFactory().rect(-180, -150, -10, 10),
         SpatialOperation.Contains,
-        ctx.makeRectangle(180, 180, -10, 10), true);
+        ctx.getShapeFactory().rect(180, 180, -10, 10), true);
   }
 
   @Test
   public void testWorldContainsXDL() throws IOException {
     setupGeo();
     testOperation(
-        ctx.makeRectangle(-180, 180, -10, 10),
+        ctx.getShapeFactory().rect(-180, 180, -10, 10),
         SpatialOperation.Contains,
-        ctx.makeRectangle(170, -170, -10, 10), true);
+        ctx.getShapeFactory().rect(170, -170, -10, 10), true);
   }
 
   /** See https://github.com/spatial4j/spatial4j/issues/85 */
@@ -161,8 +161,8 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
 
     //both on dateline but expressed using opposite signs
     setupGeo();
-    final Rectangle indexedShape = ctx.makeRectangle(180, 180, -10, 10);
-    final Rectangle queryShape = ctx.makeRectangle(-180, -180, -20, 20);
+    final Rectangle indexedShape = ctx.getShapeFactory().rect(180, 180, -10, 10);
+    final Rectangle queryShape = ctx.getShapeFactory().rect(-180, -180, -20, 20);
     final SpatialOperation operation = SpatialOperation.IsWithin;
     final boolean match = true;//yes it is within
 
@@ -277,7 +277,7 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
   }
 
   private Rectangle shiftedRect(double minX, double maxX, double minY, double maxY, int xShift) {
-    return ctx.makeRectangle(
+    return ctx.getShapeFactory().rect(
         DistanceUtils.normLonDEG(minX + xShift),
         DistanceUtils.normLonDEG(maxX + xShift),
         minY, maxY);
@@ -286,7 +286,7 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {
   public void testAreaValueSource() throws IOException {
     BBoxStrategy bboxStrategy = setupNeedsDocValuesOnly();
 
-    adoc("100", ctx.makeRectangle(0, 20, 40, 80));
+    adoc("100", ctx.getShapeFactory().rect(0, 20, 40, 80));
     adoc("999", (Shape) null);
     commit();
     checkValueSource(new ShapeAreaValueSource(bboxStrategy.makeShapeValueSource(), ctx, false, 1.0),
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/DateNRStrategyTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/DateNRStrategyTest.java
index 54296da..2571afd 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/DateNRStrategyTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/DateNRStrategyTest.java
@@ -41,7 +41,7 @@ public class DateNRStrategyTest extends RandomSpatialOpStrategyTestCase {
   @Before
   public void setUp() throws Exception {
     super.setUp();
-    tree = DateRangePrefixTree.INSTANCE;
+    tree = new DateRangePrefixTree(DateRangePrefixTree.DEFAULT_CAL);
     strategy = new NumberRangePrefixTreeStrategy(tree, "dateRange");
     ((NumberRangePrefixTreeStrategy)strategy).setPointsOnly(randomInt() % 5 == 0);
     Calendar tmpCal = tree.newCal();
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/HeatmapFacetCounterTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/HeatmapFacetCounterTest.java
index aeb412a..357a487 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/HeatmapFacetCounterTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/HeatmapFacetCounterTest.java
@@ -37,6 +37,7 @@ import org.locationtech.spatial4j.shape.Circle;
 import org.locationtech.spatial4j.shape.Point;
 import org.locationtech.spatial4j.shape.Rectangle;
 import org.locationtech.spatial4j.shape.Shape;
+import org.locationtech.spatial4j.shape.ShapeFactory;
 import org.locationtech.spatial4j.shape.SpatialRelation;
 import org.locationtech.spatial4j.shape.impl.RectangleImpl;
 
@@ -46,6 +47,7 @@ import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween
 public class HeatmapFacetCounterTest extends StrategyTestCase {
 
   SpatialPrefixTree grid;
+  ShapeFactory shapeFactory;
 
   int cellsValidated;
   int cellValidatedNonZero;
@@ -55,6 +57,7 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
     super.setUp();
     cellsValidated = cellValidatedNonZero = 0;
     ctx = SpatialContext.GEO;
+    shapeFactory = ctx.getShapeFactory();
     grid = new QuadPrefixTree(ctx, randomIntBetween(1, 8));
     strategy = new RecursivePrefixTreeStrategy(grid, getTestClass().getSimpleName());
     if (rarely()) {
@@ -70,14 +73,14 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
   @Test
   public void testStatic() throws IOException {
     //Some specific tests (static, not random).
-    adoc("0", ctx.makeRectangle(179.8, -170, -90, -80));//barely crosses equator
-    adoc("1", ctx.makePoint(-180, -85));//a pt within the above rect
-    adoc("2", ctx.makePoint(172, -85));//a pt to left of rect
+    adoc("0", shapeFactory.rect(179.8, -170, -90, -80));//barely crosses equator
+    adoc("1", shapeFactory.pointXY(-180, -85));//a pt within the above rect
+    adoc("2", shapeFactory.pointXY(172, -85));//a pt to left of rect
     commit();
 
-    validateHeatmapResultLoop(ctx.makeRectangle(+170, +180, -90, -85), 1, 100);
-    validateHeatmapResultLoop(ctx.makeRectangle(-180, -160, -89, -50), 1, 100);
-    validateHeatmapResultLoop(ctx.makeRectangle(179, 179, -89, -50), 1, 100);//line
+    validateHeatmapResultLoop(shapeFactory.rect(+170, +180, -90, -85), 1, 100);
+    validateHeatmapResultLoop(shapeFactory.rect(-180, -160, -89, -50), 1, 100);
+    validateHeatmapResultLoop(shapeFactory.rect(179, 179, -89, -50), 1, 100);//line
     // We could test anything and everything at this point... I prefer we leave that to random testing and then
     // add specific tests if we find a bug.
   }
@@ -86,9 +89,9 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
   public void testLucene7291Dateline() throws IOException {
     grid = new QuadPrefixTree(ctx, 2); // only 2, and we wind up with some big leaf cells
     strategy = new RecursivePrefixTreeStrategy(grid, getTestClass().getSimpleName());
-    adoc("0", ctx.makeRectangle(-102, -83, 43, 52));
+    adoc("0", shapeFactory.rect(-102, -83, 43, 52));
     commit();
-    validateHeatmapResultLoop(ctx.makeRectangle(179, -179, 62, 63), 2, 100);// HM crosses dateline
+    validateHeatmapResultLoop(shapeFactory.rect(179, -179, 62, 63), 2, 100);// HM crosses dateline
   }
 
   @Test
@@ -98,12 +101,13 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
     spatialContextFactory.geo = false;
     spatialContextFactory.worldBounds = new RectangleImpl(-90, 90, -90, 90, null);
     ctx = spatialContextFactory.newSpatialContext();
+    shapeFactory = ctx.getShapeFactory();
     final int LEVEL = 4;
     grid = new QuadPrefixTree(ctx, LEVEL);
     strategy = new RecursivePrefixTreeStrategy(grid, getTestClass().getSimpleName());
-    Circle circle = ctx.makeCircle(0, 0, 89);
-    adoc("0", ctx.makePoint(88, 88));//top-right, inside bbox of circle but not the circle
-    adoc("1", ctx.makePoint(0, 0));//clearly inside; dead center in fact
+    Circle circle = shapeFactory.circle(0, 0, 89);
+    adoc("0", shapeFactory.pointXY(88, 88));//top-right, inside bbox of circle but not the circle
+    adoc("1", shapeFactory.pointXY(0, 0));//clearly inside; dead center in fact
     commit();
     final HeatmapFacetCounter.Heatmap heatmap = HeatmapFacetCounter.calcFacets(
         (PrefixTreeStrategy) strategy, indexSearcher.getTopReaderContext(), null,
@@ -178,7 +182,7 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
     // and once with dateline wrap
     if (rect.getWidth() > 0) {
       double shift = random().nextDouble() % rect.getWidth();
-      queryHeatmapRecursive(ctx.makeRectangle(
+      queryHeatmapRecursive(shapeFactory.rect(
               DistanceUtils.normLonDEG(rect.getMinX() - shift),
               DistanceUtils.normLonDEG(rect.getMaxX() - shift),
               rect.getMinY(), rect.getMaxY()),
@@ -231,7 +235,7 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
         final int facetCount = heatmap.getCount(c, r);
         double x = DistanceUtils.normLonDEG(heatRect.getMinX() + c * cellWidth + cellWidth / 2);
         double y = DistanceUtils.normLatDEG(heatRect.getMinY() + r * cellHeight + cellHeight / 2);
-        Point pt =  ctx.makePoint(x, y);
+        Point pt =  shapeFactory.pointXY(x, y);
         assertEquals(countMatchingDocsAtLevel(pt, facetLevel), facetCount);
       }
     }
@@ -258,4 +262,4 @@ public class HeatmapFacetCounterTest extends StrategyTestCase {
       return randomRectangle();
     }
   }
-}
\ No newline at end of file
+}
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
index 7d029f1..47a92e6 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
@@ -99,10 +99,10 @@ public class JtsPolygonTest extends StrategyTestCase {
     }
     addDocument(doc);
 
-    Point upperleft = ctx.makePoint(-122.88, 48.54);
-    Point lowerright = ctx.makePoint(-122.82, 48.62);
+    Point upperleft = ctx.getShapeFactory().pointXY(-122.88, 48.54);
+    Point lowerright = ctx.getShapeFactory().pointXY(-122.82, 48.62);
 
-    Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.Intersects, ctx.makeRectangle(upperleft, lowerright)));
+    Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.Intersects, ctx.getShapeFactory().rect(upperleft, lowerright)));
     commit();
 
     TopDocs search = indexSearcher.search(query, 10);
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/NumberRangeFacetsTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/NumberRangeFacetsTest.java
index 9c12883..3ddf0c7 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/NumberRangeFacetsTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/NumberRangeFacetsTest.java
@@ -42,7 +42,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.locationtech.spatial4j.shape.Shape;
 
-import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween;
 
 public class NumberRangeFacetsTest extends StrategyTestCase {
@@ -55,7 +54,7 @@ public class NumberRangeFacetsTest extends StrategyTestCase {
   @Before
   public void setUp() throws Exception {
     super.setUp();
-    tree = DateRangePrefixTree.INSTANCE;
+    tree = new DateRangePrefixTree(DateRangePrefixTree.DEFAULT_CAL);
     strategy = new NumberRangePrefixTreeStrategy(tree, "dateRange");
     Calendar tmpCal = tree.newCal();
     randomCalWindowField = randomIntBetween(1, Calendar.ZONE_OFFSET - 1);//we're not allowed to add zone offset
@@ -104,9 +103,9 @@ public class NumberRangeFacetsTest extends StrategyTestCase {
         calFieldFacet--;
       }
       final Calendar leftCal = randomCalendar();
-      leftCal.add(calFieldFacet, -1 * randomInt(1000));
+      leftCal.add(calFieldFacet, -1 * randomIntBetween(0, 1000));
       Calendar rightCal = (Calendar) leftCal.clone();
-      rightCal.add(calFieldFacet, randomInt(2000));
+      rightCal.add(calFieldFacet, randomIntBetween(0, 2000));
       // Pick facet detail level based on cal field.
       int detailLevel = tree.getTreeLevelForCalendarField(calFieldFacet);
       if (detailLevel < 0) {//no exact match
@@ -126,7 +125,7 @@ public class NumberRangeFacetsTest extends StrategyTestCase {
           acceptFieldIds.add(i);
         }
         Collections.shuffle(acceptFieldIds, random());
-        acceptFieldIds = acceptFieldIds.subList(0, randomInt(acceptFieldIds.size()));
+        acceptFieldIds = acceptFieldIds.subList(0, randomIntBetween(0, acceptFieldIds.size()));
         if (!acceptFieldIds.isEmpty()) {
           List<BytesRef> terms = new ArrayList<>();
           for (Integer acceptDocId : acceptFieldIds) {
@@ -237,7 +236,7 @@ public class NumberRangeFacetsTest extends StrategyTestCase {
   private void preQueryHavoc() {
     if (strategy instanceof RecursivePrefixTreeStrategy) {
       RecursivePrefixTreeStrategy rpts = (RecursivePrefixTreeStrategy) strategy;
-      int scanLevel = randomInt(rpts.getGrid().getMaxLevels());
+      int scanLevel = randomIntBetween(0, rpts.getGrid().getMaxLevels());
       rpts.setPrefixGridScanLevel(scanLevel);
     }
   }
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/RandomSpatialOpStrategyTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/RandomSpatialOpStrategyTestCase.java
index 22c5839..8aebafe 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/RandomSpatialOpStrategyTestCase.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/RandomSpatialOpStrategyTestCase.java
@@ -28,7 +28,6 @@ import org.apache.lucene.spatial.StrategyTestCase;
 import org.apache.lucene.spatial.query.SpatialArgs;
 import org.apache.lucene.spatial.query.SpatialOperation;
 
-import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween;
 
 /** Base test harness, ideally for SpatialStrategy impls that have exact results
@@ -130,7 +129,7 @@ public abstract class RandomSpatialOpStrategyTestCase extends StrategyTestCase {
   protected void preQueryHavoc() {
     if (strategy instanceof RecursivePrefixTreeStrategy) {
       RecursivePrefixTreeStrategy rpts = (RecursivePrefixTreeStrategy) strategy;
-      int scanLevel = randomInt(rpts.getGrid().getMaxLevels());
+      int scanLevel = randomIntBetween(0, rpts.getGrid().getMaxLevels());
       rpts.setPrefixGridScanLevel(scanLevel);
     }
   }
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
index 18cc536..14e2140 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
@@ -70,11 +70,11 @@ public class TestRecursivePrefixTreeStrategy extends StrategyTestCase {
   public void testPrecision() throws IOException{
     init(GeohashPrefixTree.getMaxLevelsPossible());
 
-    Point iPt = ctx.makePoint(2.8028712999999925, 48.3708044);//lon, lat
+    Point iPt = ctx.getShapeFactory().pointXY(2.8028712999999925, 48.3708044);//lon, lat
     addDocument(newDoc("iPt", iPt));
     commit();
 
-    Point qPt = ctx.makePoint(2.4632387000000335, 48.6003516);
+    Point qPt = ctx.getShapeFactory().pointXY(2.4632387000000335, 48.6003516);
 
     final double KM2DEG = DistanceUtils.dist2Degrees(1, DistanceUtils.EARTH_MEAN_RADIUS_KM);
     final double DEG2KM = 1 / KM2DEG;
@@ -101,7 +101,7 @@ public class TestRecursivePrefixTreeStrategy extends StrategyTestCase {
   }
 
   private SpatialArgs q(Point pt, double distDEG, double distErrPct) {
-    Shape shape = ctx.makeCircle(pt, distDEG);
+    Shape shape = ctx.getShapeFactory().circle(pt, distDEG);
     SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects,shape);
     args.setDistErrPct(distErrPct);
     return args;
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeSphereModelRectRelationTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeSphereModelRectRelationTest.java
index fb4f678..3e61661 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeSphereModelRectRelationTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeSphereModelRectRelationTest.java
@@ -71,7 +71,7 @@ public class Geo3dShapeSphereModelRectRelationTest extends ShapeRectRelationTest
     GeoCircle geo3dCircle = GeoCircleFactory.makeGeoCircle(planetModel, 1.6282053147165243E-4 * RADIANS_PER_DEGREE,
         -70.1600629789353 * RADIANS_PER_DEGREE, 86 * RADIANS_PER_DEGREE);
     Geo3dShape<GeoCircle> geo3dShape = new Geo3dShape<>(geo3dCircle, ctx);
-    Rectangle rect = ctx.makeRectangle(-118, -114, -2.0, 32.0);
+    Rectangle rect = ctx.getShapeFactory().rect(-118, -114, -2.0, 32.0);
     assertTrue(geo3dShape.relate(rect).intersects());
     // thus the bounding box must intersect too
     assertTrue(geo3dShape.getBoundingBox().relate(rect).intersects());
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/RandomizedShapeTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/RandomizedShapeTestCase.java
index 0c18f5d..eb3563b 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/RandomizedShapeTestCase.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/RandomizedShapeTestCase.java
@@ -17,40 +17,17 @@
 package org.apache.lucene.spatial.spatial4j;
 
 import org.locationtech.spatial4j.context.SpatialContext;
-import org.locationtech.spatial4j.distance.DistanceUtils;
-import org.locationtech.spatial4j.shape.Circle;
-import org.locationtech.spatial4j.shape.Point;
-import org.locationtech.spatial4j.shape.Rectangle;
-import org.locationtech.spatial4j.shape.Shape;
-import org.locationtech.spatial4j.shape.SpatialRelation;
-import org.locationtech.spatial4j.shape.impl.Range;
-
-import static org.locationtech.spatial4j.shape.SpatialRelation.CONTAINS;
-import static org.locationtech.spatial4j.shape.SpatialRelation.WITHIN;
 
 import org.apache.lucene.util.LuceneTestCase;
 
-import static com.carrotsearch.randomizedtesting.RandomizedTest.*;
-
 /**
  * A base test class with utility methods to help test shapes.
  * Extends from RandomizedTest.
  */
 public abstract class RandomizedShapeTestCase extends LuceneTestCase {
 
-  protected static final double EPS = 10e-9;
-
   protected SpatialContext ctx;//needs to be set ASAP
 
-  /** Used to reduce the space of numbers to increase the likelihood that
-   * random numbers become equivalent, and thus trigger different code paths.
-   * Also makes some random shapes easier to manually examine.
-   */
-  protected final double DIVISIBLE = 2;// even coordinates; (not always used)
-
-  protected RandomizedShapeTestCase() {
-  }
-
   public RandomizedShapeTestCase(SpatialContext ctx) {
     this.ctx = ctx;
   }
@@ -71,218 +48,8 @@ public abstract class RandomizedShapeTestCase extends LuceneTestCase {
     }
   }
 
-  //These few norm methods normalize the arguments for creating a shape to
-  // account for the dateline. Some tests loop past the dateline or have offsets
-  // that go past it and it's easier to have them coded that way and correct for
-  // it here.  These norm methods should be used when needed, not frivolously.
-
-  protected double normX(double x) {
-    return ctx.isGeo() ? DistanceUtils.normLonDEG(x) : x;
-  }
-
-  protected double normY(double y) {
-    return ctx.isGeo() ? DistanceUtils.normLatDEG(y) : y;
-  }
-
-  protected Rectangle makeNormRect(double minX, double maxX, double minY, double maxY) {
-    if (ctx.isGeo()) {
-      if (Math.abs(maxX - minX) >= 360) {
-        minX = -180;
-        maxX = 180;
-      } else {
-        minX = DistanceUtils.normLonDEG(minX);
-        maxX = DistanceUtils.normLonDEG(maxX);
-      }
-
-    } else {
-      if (maxX < minX) {
-        double t = minX;
-        minX = maxX;
-        maxX = t;
-      }
-      minX = boundX(minX, ctx.getWorldBounds());
-      maxX = boundX(maxX, ctx.getWorldBounds());
-    }
-    if (maxY < minY) {
-      double t = minY;
-      minY = maxY;
-      maxY = t;
-    }
-    minY = boundY(minY, ctx.getWorldBounds());
-    maxY = boundY(maxY, ctx.getWorldBounds());
-    return ctx.makeRectangle(minX, maxX, minY, maxY);
-  }
-
   public static double divisible(double v, double divisible) {
     return (int) (Math.round(v / divisible) * divisible);
   }
 
-  protected double divisible(double v) {
-    return divisible(v, DIVISIBLE);
-  }
-
-  /** reset()'s p, and confines to world bounds. Might not be divisible if
-   * the world bound isn't divisible too.
-   */
-  protected Point divisible(Point p) {
-    Rectangle bounds = ctx.getWorldBounds();
-    double newX = boundX( divisible(p.getX()), bounds );
-    double newY = boundY( divisible(p.getY()), bounds );
-    p.reset(newX, newY);
-    return p;
-  }
-
-  static double boundX(double i, Rectangle bounds) {
-    return bound(i, bounds.getMinX(), bounds.getMaxX());
-  }
-
-  static double boundY(double i, Rectangle bounds) {
-    return bound(i, bounds.getMinY(), bounds.getMaxY());
-  }
-
-  static double bound(double i, double min, double max) {
-    if (i < min) return min;
-    if (i > max) return max;
-    return i;
-  }
-
-  protected void assertRelation(SpatialRelation expected, Shape a, Shape b) {
-    assertRelation(null, expected, a, b);
-  }
-
-  protected void assertRelation(String msg, SpatialRelation expected, Shape a, Shape b) {
-    _assertIntersect(msg, expected, a, b);
-    //check flipped a & b w/ transpose(), while we're at it
-    _assertIntersect(msg, expected.transpose(), b, a);
-  }
-
-  private void _assertIntersect(String msg, SpatialRelation expected, Shape a, Shape b) {
-    SpatialRelation sect = a.relate(b);
-    if (sect == expected)
-      return;
-    msg = ((msg == null) ? "" : msg+"\r") + a +" intersect "+b;
-    if (expected == WITHIN || expected == CONTAINS) {
-      if (a.getClass().equals(b.getClass())) // they are the same shape type
-        assertEquals(msg,a,b);
-      else {
-        //they are effectively points or lines that are the same location
-        assertTrue(msg,!a.hasArea());
-        assertTrue(msg,!b.hasArea());
-
-        Rectangle aBBox = a.getBoundingBox();
-        Rectangle bBBox = b.getBoundingBox();
-        if (aBBox.getHeight() == 0 && bBBox.getHeight() == 0
-            && (aBBox.getMaxY() == 90 && bBBox.getMaxY() == 90
-            || aBBox.getMinY() == -90 && bBBox.getMinY() == -90))
-          ;//== a point at the pole
-        else
-          assertEquals(msg, aBBox, bBBox);
-      }
-    } else {
-      assertEquals(msg,expected,sect);//always fails
-    }
-  }
-
-  protected void assertEqualsRatio(String msg, double expected, double actual) {
-    double delta = Math.abs(actual - expected);
-    double base = Math.min(actual, expected);
-    double deltaRatio = base==0 ? delta : Math.min(delta,delta / base);
-    assertEquals(msg,0,deltaRatio, EPS);
-  }
-
-  protected int randomIntBetweenDivisible(int start, int end) {
-    return randomIntBetweenDivisible(start, end, (int)DIVISIBLE);
-  }
-  /** Returns a random integer between [start, end]. Integers between must be divisible by the 3rd argument. */
-  protected int randomIntBetweenDivisible(int start, int end, int divisible) {
-    // DWS: I tested this
-    int divisStart = (int) Math.ceil( (start+1) / (double)divisible );
-    int divisEnd = (int) Math.floor( (end-1) / (double)divisible );
-    int divisRange = Math.max(0,divisEnd - divisStart + 1);
-    int r = randomInt(1 + divisRange);//remember that '0' is counted
-    if (r == 0)
-      return start;
-    if (r == 1)
-      return end;
-    return (r-2 + divisStart)*divisible;
-  }
-
-  protected Rectangle randomRectangle(Point nearP) {
-    Rectangle bounds = ctx.getWorldBounds();
-    if (nearP == null)
-      nearP = randomPointIn(bounds);
-
-    Range xRange = randomRange(rarely() ? 0 : nearP.getX(), Range.xRange(bounds, ctx));
-    Range yRange = randomRange(rarely() ? 0 : nearP.getY(), Range.yRange(bounds, ctx));
-
-    return makeNormRect(
-        divisible(xRange.getMin()),
-        divisible(xRange.getMax()),
-        divisible(yRange.getMin()),
-        divisible(yRange.getMax()) );
-  }
-
-  private Range randomRange(double near, Range bounds) {
-    double mid = near + randomGaussian() * bounds.getWidth() / 6;
-    double width = Math.abs(randomGaussian()) * bounds.getWidth() / 6;//1/3rd
-    return new Range(mid - width / 2, mid + width / 2);
-  }
-
-  private double randomGaussianZeroTo(double max) {
-    if (max == 0)
-      return max;
-    assert max > 0;
-    double r;
-    do {
-      r = Math.abs(randomGaussian()) * (max * 0.50);
-    } while (r > max);
-    return r;
-  }
-
-  protected Rectangle randomRectangle(int divisible) {
-    double rX = randomIntBetweenDivisible(-180, 180, divisible);
-    double rW = randomIntBetweenDivisible(0, 360, divisible);
-    double rY1 = randomIntBetweenDivisible(-90, 90, divisible);
-    double rY2 = randomIntBetweenDivisible(-90, 90, divisible);
-    double rYmin = Math.min(rY1,rY2);
-    double rYmax = Math.max(rY1,rY2);
-    if (rW > 0 && rX == 180)
-      rX = -180;
-    return makeNormRect(rX, rX + rW, rYmin, rYmax);
-  }
-
-  protected Point randomPoint() {
-    return randomPointIn(ctx.getWorldBounds());
-  }
-
-  protected Point randomPointIn(Circle c) {
-    double d = c.getRadius() * randomDouble();
-    double angleDEG = 360 * randomDouble();
-    Point p = ctx.getDistCalc().pointOnBearing(c.getCenter(), d, angleDEG, ctx, null);
-    assertEquals(CONTAINS,c.relate(p));
-    return p;
-  }
-
-  protected Point randomPointIn(Rectangle r) {
-    double x = r.getMinX() + randomDouble()*r.getWidth();
-    double y = r.getMinY() + randomDouble()*r.getHeight();
-    x = normX(x);
-    y = normY(y);
-    Point p = ctx.makePoint(x,y);
-    assertEquals(CONTAINS,r.relate(p));
-    return p;
-  }
-
-  protected Point randomPointInOrNull(Shape shape) {
-    if (!shape.hasArea())// or try the center?
-      throw new UnsupportedOperationException("Need area to define shape!");
-    Rectangle bbox = shape.getBoundingBox();
-    for (int i = 0; i < 1000; i++) {
-      Point p = randomPointIn(bbox);
-      if (shape.relate(p).intersects()) {
-        return p;
-      }
-    }
-    return null;//tried too many times and failed
-  }
 }
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
index 21ca535..16ff24d 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
@@ -37,7 +37,7 @@ import org.apache.lucene.util.IntsRef;
  *  for merging results from multiple DirectSpellCheckers.
  */
 public final class LuceneLevenshteinDistance implements StringDistance {
-  
+
   /**
    * Creates a new comparator, mimicing the behavior of Lucene's internal
    * edit distance.
@@ -50,7 +50,7 @@ public final class LuceneLevenshteinDistance implements StringDistance {
     IntsRef otherPoints;
     int n;
     int d[][]; // cost array
-    
+
     // NOTE: if we cared, we could 3*m space instead of m*n space, similar to 
     // what LevenshteinDistance does, except cycling thru a ring of three 
     // horizontal cost arrays... but this comparator is never actually used by 
@@ -63,7 +63,7 @@ public final class LuceneLevenshteinDistance implements StringDistance {
     n = targetPoints.length;
     final int m = otherPoints.length;
     d = new int[n+1][m+1];
-    
+
     if (n == 0 || m == 0) {
       if (n == m) {
         return 0;
@@ -71,7 +71,7 @@ public final class LuceneLevenshteinDistance implements StringDistance {
       else {
         return Math.max(n, m);
       }
-    } 
+    }
 
     // indexes into strings s and t
     int i; // iterates through s
@@ -84,7 +84,7 @@ public final class LuceneLevenshteinDistance implements StringDistance {
     for (i = 0; i<=n; i++) {
       d[i][0] = i;
     }
-    
+
     for (j = 0; j<=m; j++) {
       d[0][j] = j;
     }
@@ -102,10 +102,10 @@ public final class LuceneLevenshteinDistance implements StringDistance {
         }
       }
     }
-    
+
     return 1.0f - ((float) d[n][m] / Math.min(m, n));
   }
-  
+
   private static IntsRef toIntsRef(String s) {
     IntsRef ref = new IntsRef(s.length()); // worst case
     int utf16Len = s.length();
@@ -114,12 +114,18 @@ public final class LuceneLevenshteinDistance implements StringDistance {
     }
     return ref;
   }
-  
+
   @Override
   public boolean equals(Object obj) {
     if (this == obj) return true;
     if (null == obj) return false;
     return (getClass() == obj.getClass());
   }
-  
+
+  @Override
+  public int hashCode() {
+    // constant hashCode since all instances of this class are equal()
+    return 6;
+  }
+
 }
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 948ebeb..5dce144 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
@@ -73,7 +73,7 @@ public class JaspellLookup extends Lookup implements Accountable {
         continue;
       }
       charsSpare.copyUTF8Bytes(spare);
-      trie.put(charsSpare.toString(), Long.valueOf(weight));
+      trie.put(charsSpare.toString(), weight);
       count++;
     }
   }
@@ -144,7 +144,7 @@ public class JaspellLookup extends Lookup implements Accountable {
     node.splitchar = in.readString().charAt(0);
     byte mask = in.readByte();
     if ((mask & HAS_VALUE) != 0) {
-      node.data = Long.valueOf(in.readLong());
+      node.data = in.readLong();
     }
     if ((mask & LO_KID) != 0) {
       TSTNode kid = new TSTNode('\0', node);
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java b/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java
index 35e8245..f275434 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
-import junit.framework.Assert;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -37,6 +35,7 @@ import org.apache.lucene.util.English;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
+import org.junit.Assert;
 
 public class TestWordBreakSpellChecker extends LuceneTestCase {
   private Directory dir;
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
index 9f9190a..5e5a4d5 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
@@ -53,7 +53,7 @@ import org.junit.Ignore;
  */
 @Ignore("COMMENT ME TO RUN BENCHMARKS!")
 public class LookupBenchmarkTest extends LuceneTestCase {
-  @SuppressWarnings("unchecked")
+  @SuppressWarnings({"unchecked","deprecation"})
   private final List<Class<? extends Lookup>> benchmarkClasses = Arrays.asList(
       FuzzySuggester.class,
       AnalyzingSuggester.class,
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java
index fd5b558..9f4c687 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/PersistenceTest.java
@@ -50,7 +50,8 @@ public class PersistenceTest extends LuceneTestCase {
   public void testTSTPersistence() throws Exception {
     runTest(TSTLookup.class, true);
   }
-  
+
+  @Deprecated
   public void testJaspellPersistence() throws Exception {
     runTest(JaspellLookup.class, true);
   }
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java b/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java
index 3cb7f0a..5583f5f 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java
@@ -23,15 +23,16 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
 
-import junit.framework.Assert;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.util.LuceneTestCase;
 
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
 
 /**
  * Utility class for asserting expected hits in tests.
@@ -60,7 +61,7 @@ public class CheckHits {
       Explanation exp = searcher.explain(q, doc);
       assertNotNull("Explanation of [["+d+"]] for #"+doc+" is null",
                              exp);
-      Assert.assertFalse("Explanation of [["+d+"]] for #"+doc+
+      assertFalse("Explanation of [["+d+"]] for #"+doc+
                          " doesn't indicate non-match: " + exp.toString(),
                          exp.isMatch());
     }
@@ -95,7 +96,7 @@ public class CheckHits {
     final Collector c = new SetCollector(actual);
 
     searcher.search(query, c);
-    Assert.assertEquals("Simple: " + query.toString(defaultFieldName), 
+    assertEquals("Simple: " + query.toString(defaultFieldName),
                         correct, actual);
 
     for (int i = -1; i < 2; i++) {
@@ -103,7 +104,7 @@ public class CheckHits {
       IndexSearcher s = QueryUtils.wrapUnderlyingReader
         (random, searcher, i);
       s.search(query, c);
-      Assert.assertEquals("Wrap Reader " + i + ": " +
+      assertEquals("Wrap Reader " + i + ": " +
                           query.toString(defaultFieldName),
                           correct, actual);
     }
@@ -168,16 +169,16 @@ public class CheckHits {
       actual.add(Integer.valueOf(hits[i].doc));
     }
 
-    Assert.assertEquals(query.toString(defaultFieldName), correct, actual);
+    assertEquals(query.toString(defaultFieldName), correct, actual);
 
     QueryUtils.check(random, query,searcher, LuceneTestCase.rarely(random));
   }
 
   /** Tests that a Hits has an expected order of documents */
   public static void checkDocIds(String mes, int[] results, ScoreDoc[] hits) {
-    Assert.assertEquals(mes + " nr of hits", hits.length, results.length);
+    assertEquals(mes + " nr of hits", hits.length, results.length);
     for (int i = 0; i < results.length; i++) {
-      Assert.assertEquals(mes + " doc nrs for hit " + i, results[i], hits[i].doc);
+      assertEquals(mes + " doc nrs for hit " + i, results[i], hits[i].doc);
     }
   }
 
@@ -198,11 +199,11 @@ public class CheckHits {
   public static void checkEqual(Query query, ScoreDoc[] hits1, ScoreDoc[] hits2) {
      final float scoreTolerance = 1.0e-6f;
      if (hits1.length != hits2.length) {
-       Assert.fail("Unequal lengths: hits1="+hits1.length+",hits2="+hits2.length);
+       fail("Unequal lengths: hits1="+hits1.length+",hits2="+hits2.length);
      }
     for (int i = 0; i < hits1.length; i++) {
       if (hits1[i].doc != hits2[i].doc) {
-        Assert.fail("Hit " + i + " docnumbers don't match\n"
+        fail("Hit " + i + " docnumbers don't match\n"
                 + hits2str(hits1, hits2,0,0)
                 + "for query:" + query.toString());
       }
@@ -210,7 +211,7 @@ public class CheckHits {
       if ((hits1[i].doc != hits2[i].doc)
           || Math.abs(hits1[i].score -  hits2[i].score) > scoreTolerance)
       {
-        Assert.fail("Hit " + i + ", doc nrs " + hits1[i].doc + " and " + hits2[i].doc
+        fail("Hit " + i + ", doc nrs " + hits1[i].doc + " and " + hits2[i].doc
                       + "\nunequal       : " + hits1[i].score
                       + "\n           and: " + hits2[i].score
                       + "\nfor query:" + query.toString());
@@ -335,9 +336,9 @@ public class CheckHits {
     float value = expl.getValue().floatValue();
     // TODO: clean this up if we use junit 5 (the assert message is costly)
     try {
-      Assert.assertEquals(score, value, 0d);
+      assertEquals(score, value, 0d);
     } catch (Exception e) {
-      Assert.fail(q+": score(doc="+doc+")="+score+" != explanationScore="+value+" Explanation: "+expl);
+      fail(q+": score(doc="+doc+")="+score+" != explanationScore="+value+" Explanation: "+expl);
     }
 
     if (!deep) return;
@@ -349,7 +350,7 @@ public class CheckHits {
     }
     String descr = expl.getDescription().toLowerCase(Locale.ROOT);
     if (descr.startsWith("score based on ") && descr.contains("child docs in range")) {
-      Assert.assertTrue("Child doc explanations are missing", detail.length > 0);
+      assertTrue("Child doc explanations are missing", detail.length > 0);
     }
     if (detail.length > 0) {
       if (detail.length==1 && COMPUTED_FROM_PATTERN.matcher(descr).matches() == false) {
@@ -388,7 +389,7 @@ public class CheckHits {
         }
         // TODO: this is a TERRIBLE assertion!!!!
         if (false == (productOf || sumOf || maxOf || computedOf || maxTimesOthers)) {
-          Assert.fail(
+          fail(
               q+": multi valued explanation description=\""+descr
               +"\" must be 'max of plus x times others', 'computed as x from:' or end with 'product of'"
               +" or 'sum of:' or 'max of:' - "+expl);
@@ -423,14 +424,14 @@ public class CheckHits {
         } else if (maxTimesOthers) {
           combined = (float) (max + x * (sum - max));
         } else {
-          Assert.assertTrue("should never get here!", computedOf);
+          assertTrue("should never get here!", computedOf);
           combined = value;
         }
         // TODO: clean this up if we use junit 5 (the assert message is costly)
         try {
-          Assert.assertEquals(combined, value, maxError);
+          assertEquals(combined, value, maxError);
         } catch (Exception e) {
-          Assert.fail(q+": actual subDetails combined=="+combined+
+          fail(q+": actual subDetails combined=="+combined+
               " != value="+value+" Explanation: "+expl);
         }
       }
@@ -444,14 +445,17 @@ public class CheckHits {
    * @see ExplanationAsserter
    */
   public static class ExplanationAssertingSearcher extends IndexSearcher {
+
     public ExplanationAssertingSearcher(IndexReader r) {
       super(r);
     }
+
     protected void checkExplanations(Query q) throws IOException {
       super.search(q,
                    new ExplanationAsserter
                    (q, null, this));
     }
+
     @Override
     public TopFieldDocs search(Query query,
                                int n,
@@ -460,17 +464,20 @@ public class CheckHits {
       checkExplanations(query);
       return super.search(query,n,sort);
     }
+
     @Override
     public void search(Query query, Collector results) throws IOException {
       checkExplanations(query);
       super.search(query, results);
     }
+
     @Override
     public TopDocs search(Query query, int n) throws IOException {
 
       checkExplanations(query);
       return super.search(query, n);
     }
+
   }
     
   /**
@@ -521,9 +528,9 @@ public class CheckHits {
       
       assertNotNull("Explanation of [["+d+"]] for #"+doc+" is null", exp);
       verifyExplanation(d,doc,scorer.score(),deep,exp);
-      Assert.assertTrue("Explanation of [["+d+"]] for #"+ doc + 
-                        " does not indicate match: " + exp.toString(), 
-                        exp.isMatch());
+      assertTrue("Explanation of [["+d+"]] for #"+ doc +
+                      " does not indicate match: " + exp.toString(),
+              exp.isMatch());
     }
     @Override
     protected void doSetNextReader(LeafReaderContext context) throws IOException {
@@ -602,7 +609,7 @@ public class CheckHits {
       Scorer s1 = w1.scorer(ctx);
       Scorer s2 = w2.scorer(ctx);
       if (s1 == null) {
-        Assert.assertTrue(s2 == null || s2.iterator().nextDoc() == DocIdSetIterator.NO_MORE_DOCS);
+        assertTrue(s2 == null || s2.iterator().nextDoc() == DocIdSetIterator.NO_MORE_DOCS);
         continue;
       }
       TwoPhaseIterator twoPhase1 = s1.twoPhaseIterator();
@@ -616,25 +623,25 @@ public class CheckHits {
         int doc1;
         for (doc1 = approx1.nextDoc(); doc1 < doc2; doc1 = approx1.nextDoc()) {
           if (twoPhase1 == null || twoPhase1.matches()) {
-            Assert.assertTrue(s1.score() < minScore);
+            assertTrue(s1.score() < minScore);
           }
         }
-        Assert.assertEquals(doc1, doc2);
+        assertEquals(doc1, doc2);
         if (doc2 == DocIdSetIterator.NO_MORE_DOCS) {
           break;
         }
 
         if (doc2 > upTo) {
           upTo = s2.advanceShallow(doc2);
-          Assert.assertTrue(upTo >= doc2);
+          assertTrue(upTo >= doc2);
           maxScore = s2.getMaxScore(upTo);
         }
 
         if (twoPhase2 == null || twoPhase2.matches()) {
-          Assert.assertTrue(twoPhase1 == null || twoPhase1.matches());
+          assertTrue(twoPhase1 == null || twoPhase1.matches());
           float score = s2.score();
-          Assert.assertEquals(s1.score(), score);
-          Assert.assertTrue(score + " > " + maxScore + " up to " + upTo, score <= maxScore);
+          assertEquals(s1.score(), score, 0);
+          assertTrue(score + " > " + maxScore + " up to " + upTo, score <= maxScore);
 
           if (score >= minScore && random.nextInt(10) == 0) {
             // On some scorers, changing the min score changes the way that docs are iterated
@@ -650,7 +657,7 @@ public class CheckHits {
       Scorer s1 = w1.scorer(ctx);
       Scorer s2 = w2.scorer(ctx);
       if (s1 == null) {
-        Assert.assertTrue(s2 == null || s2.iterator().nextDoc() == DocIdSetIterator.NO_MORE_DOCS);
+        assertTrue(s2 == null || s2.iterator().nextDoc() == DocIdSetIterator.NO_MORE_DOCS);
         continue;
       }
       TwoPhaseIterator twoPhase1 = s1.twoPhaseIterator();
@@ -691,7 +698,7 @@ public class CheckHits {
         int doc1;
         for (doc1 = approx1.advance(target); doc1 < doc2; doc1 = approx1.nextDoc()) {
           if (twoPhase1 == null || twoPhase1.matches()) {
-            Assert.assertTrue(s1.score() < minScore);
+            assertTrue(s1.score() < minScore);
           }
         }
         assertEquals(doc1, doc2);
@@ -701,17 +708,17 @@ public class CheckHits {
         }
 
         if (twoPhase2 == null || twoPhase2.matches()) {
-          Assert.assertTrue(twoPhase1 == null || twoPhase1.matches());
+          assertTrue(twoPhase1 == null || twoPhase1.matches());
           float score = s2.score();
-          Assert.assertEquals(s1.score(), score);
+          assertEquals(s1.score(), score, 0);
 
           if (doc2 > upTo) {
             upTo = s2.advanceShallow(doc2);
-            Assert.assertTrue(upTo >= doc2);
+            assertTrue(upTo >= doc2);
             maxScore = s2.getMaxScore(upTo);
           }
 
-          Assert.assertTrue(score <= maxScore);
+          assertTrue(score <= maxScore);
 
           if (score >= minScore && random.nextInt(10) == 0) {
             // On some scorers, changing the min score changes the way that docs are iterated
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/QueryUtils.java b/lucene/test-framework/src/java/org/apache/lucene/search/QueryUtils.java
index cdbac77..fdd5fb2 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/search/QueryUtils.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/search/QueryUtils.java
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Random;
 
-import junit.framework.Assert;
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.Fields;
@@ -39,10 +38,11 @@ import org.apache.lucene.index.Terms;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.Version;
+import org.junit.Assert;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Utility class for sanity-checking queries.
@@ -424,7 +424,7 @@ public class QueryUtils {
                 break;
               }
             }
-            Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
+            assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
           }
         }
       }
@@ -453,11 +453,11 @@ public class QueryUtils {
           for (int i=lastDoc[0]+1; i<=doc; i++) {
             Weight w = s.createWeight(rewritten, ScoreMode.COMPLETE, 1);
             Scorer scorer = w.scorer(context.get(leafPtr));
-            Assert.assertTrue("query collected "+doc+" but advance("+i+") says no more docs!",scorer.iterator().advance(i) != DocIdSetIterator.NO_MORE_DOCS);
-            Assert.assertEquals("query collected "+doc+" but advance("+i+") got to "+scorer.docID(),doc,scorer.docID());
+            assertTrue("query collected "+doc+" but advance("+i+") says no more docs!",scorer.iterator().advance(i) != DocIdSetIterator.NO_MORE_DOCS);
+            assertEquals("query collected "+doc+" but advance("+i+") got to "+scorer.docID(),doc,scorer.docID());
             float advanceScore = scorer.score();
-            Assert.assertEquals("unstable advance("+i+") score!",advanceScore,scorer.score(),maxDiff);
-            Assert.assertEquals("query assigned doc "+doc+" a score of <"+score+"> but advance("+i+") has <"+advanceScore+">!",score,advanceScore,maxDiff);
+            assertEquals("unstable advance("+i+") score!",advanceScore,scorer.score(),maxDiff);
+            assertEquals("query assigned doc "+doc+" a score of <"+score+"> but advance("+i+") has <"+advanceScore+">!",score,advanceScore,maxDiff);
 
             // Hurry things along if they are going slow (eg
             // if you got SimpleText codec this will kick in):
@@ -496,7 +496,7 @@ public class QueryUtils {
                 break;
               }
             }
-            Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
+            assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
           }
           leafPtr++;
         }
@@ -524,7 +524,7 @@ public class QueryUtils {
             break;
           }
         }
-        Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
+        assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
       }
     }
   }
@@ -561,8 +561,8 @@ public class QueryUtils {
           public void collect(int doc) throws IOException {
             assert doc >= min;
             assert doc < max;
-            Assert.assertEquals(scorer.docID(), doc);
-            Assert.assertEquals(scorer.score(), scorer2.score(), 0.01f);
+            assertEquals(scorer.docID(), doc);
+            assertEquals(scorer.score(), scorer2.score(), 0.01f);
             iterator.nextDoc();
           }
         }, null, min, max);
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java b/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java
index 19111d1..70bae83 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java
@@ -340,6 +340,7 @@ public class FSTTester<T> {
   }
 
   // FST is complete
+  @SuppressWarnings("deprecation")
   private void verifyUnPruned(int inputMode, FST<T> fst) throws IOException {
 
     final FST<Long> fstLong;
diff --git a/lucene/test-framework/src/test/org/apache/lucene/search/TestBaseExplanationTestCase.java b/lucene/test-framework/src/test/org/apache/lucene/search/TestBaseExplanationTestCase.java
index 2f0f067..1889d5e 100644
--- a/lucene/test-framework/src/test/org/apache/lucene/search/TestBaseExplanationTestCase.java
+++ b/lucene/test-framework/src/test/org/apache/lucene/search/TestBaseExplanationTestCase.java
@@ -21,21 +21,19 @@ import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.Term;
 
 
-import junit.framework.AssertionFailedError;
-
-/** 
+/**
  * Tests that the {@link BaseExplanationTestCase} helper code, as well as 
  * {@link CheckHits#checkNoMatchExplanations} are checking what they are suppose to.
  */
 public class TestBaseExplanationTestCase extends BaseExplanationTestCase {
 
   public void testQueryNoMatchWhenExpected() throws Exception {
-    expectThrows(AssertionFailedError.class, () -> {
+    expectThrows(AssertionError.class, () -> {
         qtest(new TermQuery(new Term(FIELD, "BOGUS")), new int[] { 3 /* none */ });
       });
   }
   public void testQueryMatchWhenNotExpected() throws Exception {
-    expectThrows(AssertionFailedError.class, () -> {
+    expectThrows(AssertionError.class, () -> {
         qtest(new TermQuery(new Term(FIELD, "w1")), new int[] { 0, 1 /*, 2, 3 */ });
       });
   }
@@ -45,7 +43,7 @@ public class TestBaseExplanationTestCase extends BaseExplanationTestCase {
     qtest(new TermQuery(new Term(FIELD, "zz")), new int[] { 1, 3 });
 
     // ensure when the Explanations are broken, we get an error about those matches
-    expectThrows(AssertionFailedError.class, () -> {
+    expectThrows(AssertionError.class, () -> {
         qtest(new BrokenExplainTermQuery(new Term(FIELD, "zz"), false, true), new int[] { 1, 3 });
               
       });
@@ -56,7 +54,7 @@ public class TestBaseExplanationTestCase extends BaseExplanationTestCase {
     qtest(new TermQuery(new Term(FIELD, "zz")), new int[] { 1, 3 });
     
     // ensure when the Explanations are broken, we get an error about the non matches
-    expectThrows(AssertionFailedError.class, () -> {
+    expectThrows(AssertionError.class, () -> {
         CheckHits.checkNoMatchExplanations(new BrokenExplainTermQuery(new Term(FIELD, "zz"), true, false),
                                            FIELD, searcher, new int[] { 1, 3 });
       });
diff --git a/lucene/test-framework/src/test/org/apache/lucene/util/TestExceptionInBeforeClassHooks.java b/lucene/test-framework/src/test/org/apache/lucene/util/TestExceptionInBeforeClassHooks.java
index bd99b4b..16c64cf 100644
--- a/lucene/test-framework/src/test/org/apache/lucene/util/TestExceptionInBeforeClassHooks.java
+++ b/lucene/test-framework/src/test/org/apache/lucene/util/TestExceptionInBeforeClassHooks.java
@@ -20,8 +20,7 @@ import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import junit.framework.Assert;
-
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
diff --git a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
index 00108d7..b579eb5 100644
--- a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
+++ b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
@@ -21,7 +21,6 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.AssertionFailedError;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryUtils;
 import org.apache.solr.SolrTestCaseJ4;
@@ -1241,7 +1240,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
   public void testPayloadScoreQuery() throws Exception {
     // There was a bug with PayloadScoreQuery's .equals() method that said two queries were equal with different includeSpanScore settings
 
-    expectThrows(AssertionFailedError.class, "queries should not have been equal",
+    expectThrows(AssertionError.class, "queries should not have been equal",
         () -> assertQueryEquals
             ("payload_score"
                 , "{!payload_score f=foo_dpf v=query func=min includeSpanScore=false}"
@@ -1251,7 +1250,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
   }
 
   public void testPayloadCheckQuery() throws Exception {
-    expectThrows(AssertionFailedError.class, "queries should not have been equal",
+    expectThrows(AssertionError.class, "queries should not have been equal",
         () -> assertQueryEquals
             ("payload_check"
                 , "{!payload_check f=foo_dpf payloads=2}one"
@@ -1282,7 +1281,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
         "{!bool must='{!lucene}foo_s:c' filter='{!lucene}foo_s:d' " +
             "must_not='{!lucene}foo_s:a' should='{!lucene}foo_s:b' filter='{!lucene}foo_s:e'}");
 
-    expectThrows(AssertionFailedError.class, "queries should not have been equal",
+    expectThrows(AssertionError.class, "queries should not have been equal",
         () -> assertQueryEquals
             ("bool"
                 , "{!bool must='{!lucene}foo_s:a'}"