Apache Solr open-source search software
SOLR-15385 RawTypes Part III, contrib and solrj (#169)
Mike Drob1725e778ac86
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex adb4b5e2adc..a50911483b6 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -321,7 +321,7 @@ Other Changes* SOLR-15439: Upgrade jose4j library used for JWT authentication processing, to v0.7.7 (janhoy)-* SOLR-15385: Address many rawtypes warnings, resulting in several modified signatures in the public API. (Mike Drob, David Smiley)+* SOLR-15385: Address many rawtypes warnings, resulting in several modified signatures in the public API. (Mike Drob, David Smiley, Christine Poerschke)* SOLR-15470: The binary distribution no longer contains test-framework jars (janhoy)diff --git a/solr/contrib/analytics/src/java/org/apache/solr/analytics/AnalyticsRequestParser.java b/solr/contrib/analytics/src/java/org/apache/solr/analytics/AnalyticsRequestParser.javaindex 546cabab3f7..2255499d8b1 100644--- a/solr/contrib/analytics/src/java/org/apache/solr/analytics/AnalyticsRequestParser.java+++ b/solr/contrib/analytics/src/java/org/apache/solr/analytics/AnalyticsRequestParser.java@@ -350,7 +350,6 @@ public class AnalyticsRequestParser {return new PivotFacet(name, topPivot);}- @SuppressWarnings({"unchecked", "rawtypes"})private static PivotNode<?> constructPivot(AnalyticsPivotRequest pivotRequest,PivotNode<?> childPivot,ExpressionFactory expressionFactory,@@ -377,7 +376,7 @@ public class AnalyticsRequestParser {if (childPivot == null) {pivot = new PivotNode.PivotLeaf(pivotRequest.name, (StringValueStream)expr);} else {- pivot = new PivotNode.PivotBranch(pivotRequest.name, (StringValueStream)expr, childPivot);+ pivot = new PivotNode.PivotBranch<>(pivotRequest.name, (StringValueStream)expr, childPivot);}// Check if the pivot is sorteddiff --git a/solr/contrib/analytics/src/java/org/apache/solr/analytics/TimeExceededStubException.java b/solr/contrib/analytics/src/java/org/apache/solr/analytics/TimeExceededStubException.javaindex 4b0eec85b09..4b779e0677b 100644--- a/solr/contrib/analytics/src/java/org/apache/solr/analytics/TimeExceededStubException.java+++ b/solr/contrib/analytics/src/java/org/apache/solr/analytics/TimeExceededStubException.java@@ -20,7 +20,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.params.CommonParams;import org.apache.solr.response.SolrQueryResponse;-@SuppressWarnings("serial")public final class TimeExceededStubException extends SolrException {private static final int HTTP_CODE = 524;diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/SolrAnalyticsTestCase.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/SolrAnalyticsTestCase.javaindex 535238e7e30..1874c964fab 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/SolrAnalyticsTestCase.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/SolrAnalyticsTestCase.java@@ -18,7 +18,6 @@ package org.apache.solr.analytics;import java.io.IOException;import java.time.Instant;-import java.util.ArrayList;import java.util.Arrays;import java.util.Comparator;import java.util.Date;@@ -316,25 +315,6 @@ public class SolrAnalyticsTestCase extends SolrCloudTestCase {}}- /*- * FacetValuePair, contains the expression and the expected result- */- @SuppressWarnings("rawtypes")- protected static class PivotFVP extends FVP {- final public String pivot;- final public List<FVP> children;-- public PivotFVP(int order, String pivot, String facetValue, Map<String, Comparable> expectedResults) {- super(order, facetValue, expectedResults);- this.pivot = pivot;- children = new ArrayList<>();- }-- public void addChild(FVP child) {- children.add(child);- }- }-@SuppressWarnings("unchecked")protected static Object convertDatesToStrings(Object value) {if (value instanceof Date) {diff --git a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.javaindex afb4c9f92fb..e5234025a5f 100644--- a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java+++ b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/ClusteringComponent.java@@ -442,7 +442,7 @@ public class ClusteringComponent extends SearchComponent implements SolrCoreAwar1.0f,TotalHits.Relation.EQUAL_TO);- NamedList<Object> highlights = highlighter.doHighlighting(docAsList, query, req, fieldsToCluster);+ NamedList<?> highlights = highlighter.doHighlighting(docAsList, query, req, fieldsToCluster);if (highlights != null && highlights.size() == 1) {@SuppressWarnings("unchecked")NamedList<String[]> tmp = (NamedList<String[]>) highlights.getVal(0);diff --git a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.javaindex 75a4a25784e..5be32e0c260 100644--- a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java+++ b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java@@ -132,7 +132,6 @@ public class ExtractingDocumentLoader extends ContentStreamLoader {}@Override- @SuppressWarnings({"unchecked"})public void load(SolrQueryRequest req, SolrQueryResponse rsp,ContentStream stream, UpdateRequestProcessor processor) throws Exception {Parser parser = null;@@ -244,8 +243,7 @@ public class ExtractingDocumentLoader extends ContentStreamLoader {rsp.add(stream.getName(), writer.toString());writer.close();String[] names = metadata.names();- @SuppressWarnings({"rawtypes"})- NamedList metadataNL = new NamedList();+ NamedList<String[]> metadataNL = new NamedList<>();for (int i = 0; i < names.length; i++) {String[] vals = metadata.getValues(names[i]);metadataNL.add(names[i], vals);diff --git a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ParseContextConfig.java b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ParseContextConfig.javaindex b9f58f0b070..4fdba823bde 100644--- a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ParseContextConfig.java+++ b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ParseContextConfig.java@@ -116,7 +116,7 @@ public class ParseContextConfig {return editor.getValue();}- @SuppressWarnings({"rawtypes", "unchecked"})+ @SuppressWarnings({"unchecked"})public ParseContext create() {final ParseContext result = new ParseContext();diff --git a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/XLSXResponseWriter.java b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/XLSXResponseWriter.javaindex 9665b25ffd8..b225ceba7b9 100644--- a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/XLSXResponseWriter.java+++ b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/XLSXResponseWriter.java@@ -231,13 +231,12 @@ class XLSXWriter extends TabularResponseWriter {}//NOTE: a document cannot currently contain another document- @SuppressWarnings({"rawtypes"})- List tmpList;+ List<Object> tmpList;+@Override- @SuppressWarnings({"unchecked", "rawtypes"})public void writeSolrDocument(String name, SolrDocument doc, ReturnFields returnFields, int idx ) throws IOException {if (tmpList == null) {- tmpList = new ArrayList(1);+ tmpList = new ArrayList<>(1);tmpList.add(null);}@@ -250,10 +249,10 @@ class XLSXWriter extends TabularResponseWriter {}if ((xlField.sf != null && xlField.sf.multiValued()) || nVals > 1) {- Collection values;+ Collection<?> values;// normalize to a collectionif (val instanceof Collection) {- values = (Collection)val;+ values = (Collection<?>)val;} else {tmpList.set(0, val);values = tmpList;@@ -264,7 +263,7 @@ class XLSXWriter extends TabularResponseWriter {} else {// normalize to first valueif (val instanceof Collection) {- Collection values = (Collection)val;+ Collection<?> values = (Collection<?>)val;val = values.iterator().next();}writeVal(xlField.name, val);@@ -279,7 +278,7 @@ class XLSXWriter extends TabularResponseWriter {}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ public void writeArray(String name, Iterator<?> val) throws IOException {StringBuffer output = new StringBuffer();while (val.hasNext()) {Object v = val.next();diff --git a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.javaindex a68870844cf..91ebc8234b6 100644--- a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java+++ b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java@@ -467,15 +467,13 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {assertTrue("handler is null and it shouldn't be", handler != null);SolrQueryResponse rsp = loadLocal("extraction/solr-word.pdf", ExtractingParams.EXTRACT_ONLY, "true");assertTrue("rsp is null and it shouldn't be", rsp != null);- @SuppressWarnings({"rawtypes"})- NamedList list = rsp.getValues();+ NamedList<?> list = rsp.getValues();String extraction = (String) list.get("solr-word.pdf");assertTrue("extraction is null and it shouldn't be", extraction != null);assertTrue(extraction + " does not contain " + "solr-word", extraction.indexOf("solr-word") != -1);- @SuppressWarnings({"rawtypes"})- NamedList nl = (NamedList) list.get("solr-word.pdf_metadata");+ NamedList<?> nl = (NamedList<?>) list.get("solr-word.pdf_metadata");assertTrue("nl is null and it shouldn't be", nl != null);Object title = nl.get("title");assertTrue("title is null and it shouldn't be", title != null);@@ -491,7 +489,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {assertTrue(extraction + " does not contain " + "solr-word", extraction.indexOf("solr-word") != -1);assertTrue(extraction.indexOf("<?xml") == -1);- nl = (NamedList) list.get("solr-word.pdf_metadata");+ nl = (NamedList<?>) list.get("solr-word.pdf_metadata");assertTrue("nl is null and it shouldn't be", nl != null);title = nl.get("title");assertTrue("title is null and it shouldn't be", title != null);@@ -509,8 +507,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {ExtractingParams.EXTRACT_ONLY, "true");assertTrue("rsp is null and it shouldn't be", rsp != null);- @SuppressWarnings({"rawtypes"})- NamedList list = rsp.getValues();+ NamedList<?> list = rsp.getValues();String val = (String) list.get("example.html");assertEquals("News", val.trim()); //there is only one matching <a> tagdiff --git a/solr/contrib/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java b/solr/contrib/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.javaindex 6fc94857676..23b5d81e610 100644--- a/solr/contrib/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java+++ b/solr/contrib/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java@@ -54,7 +54,6 @@ public class GCSBackupRepositoryTest extends AbstractBackupRepositoryTest {}@Override- @SuppressWarnings("rawtypes")protected BackupRepository getRepository() {final NamedList<Object> config = new NamedList<>();config.add(CoreAdminParams.BACKUP_LOCATION, "backup1");diff --git a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/collector/SchedulerMetricsCollector.java b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/collector/SchedulerMetricsCollector.javaindex 7607d1f9326..f258932c2a1 100644--- a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/collector/SchedulerMetricsCollector.java+++ b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/collector/SchedulerMetricsCollector.java@@ -77,9 +77,8 @@ public class SchedulerMetricsCollector implements Closeable {scheduler.scheduleWithFixedDelay(this::collectMetrics, 0, duration, timeUnit);}- private@SuppressWarnings({"try"})- void collectMetrics() {-+ @SuppressWarnings("try")+ private void collectMetrics() {try (Histogram.Timer timer = metricsCollectionTime.startTimer()) {log.info("Beginning metrics collection");diff --git a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/MetricsQuery.java b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/MetricsQuery.javaindex 7448a7ec9e2..23e2d33fe5e 100644--- a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/MetricsQuery.java+++ b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/MetricsQuery.java@@ -21,7 +21,6 @@ import java.util.ArrayList;import java.util.List;import java.util.Map;import java.util.Optional;-import java.util.Set;import java.util.regex.Matcher;import net.thisptr.jackson.jq.JsonQuery;@@ -89,24 +88,26 @@ public class MetricsQuery {return jsonQueries;}- @SuppressWarnings({"unchecked", "rawtypes"})public static List<MetricsQuery> from(Node node, Map<String,MetricsQueryTemplate> jqTemplates) throws JsonQueryException {List<MetricsQuery> metricsQueries = new ArrayList<>();- NamedList config = DOMUtil.childNodesToNamedList(node);- List<NamedList> requests = config.getAll("request");+ NamedList<?> config = DOMUtil.childNodesToNamedList(node);+ @SuppressWarnings("unchecked")+ List<NamedList<?>> requests = (List<NamedList<?>>) config.getAll("request");- for (NamedList request : requests) {- NamedList query = (NamedList) request.get("query");- NamedList queryParameters = (NamedList) query.get("params");+ for (NamedList<?> request : requests) {+ NamedList<?> query = (NamedList<?>) request.get("query");+ @SuppressWarnings("unchecked")+ NamedList<String> queryParameters = (NamedList<String>) query.get("params");String path = (String) query.get("path");String core = (String) query.get("core");String collection = (String) query.get("collection");+ @SuppressWarnings("unchecked")List<String> jsonQueries = (ArrayList<String>) request.get("jsonQueries");ModifiableSolrParams params = new ModifiableSolrParams();if (queryParameters != null) {- for (Map.Entry<String, String> entrySet : (Set<Map.Entry<String, String>>) queryParameters.asShallowMap().entrySet()) {+ for (Map.Entry<String, String> entrySet : queryParameters.asShallowMap().entrySet()) {params.add(entrySet.getKey(), entrySet.getValue());}}diff --git a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/PrometheusExporterSettings.java b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/PrometheusExporterSettings.javaindex 68eda8d430d..964dfe3565f 100644--- a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/PrometheusExporterSettings.java+++ b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/PrometheusExporterSettings.java@@ -57,15 +57,14 @@ public class PrometheusExporterSettings {}public static PrometheusExporterSettings from(Node settings) {- @SuppressWarnings({"rawtypes"})- NamedList config = DOMUtil.childNodesToNamedList(settings);+ NamedList<?> config = DOMUtil.childNodesToNamedList(settings);Builder builder = builder();- @SuppressWarnings({"unchecked", "rawtypes"})- List<NamedList> httpClientSettings = config.getAll("httpClients");+ @SuppressWarnings("unchecked")+ List<NamedList<?>> httpClientSettings = (List<NamedList<?>>) config.getAll("httpClients");- for (@SuppressWarnings({"rawtypes"})NamedList entry : httpClientSettings) {+ for (NamedList<?> entry : httpClientSettings) {Integer connectionTimeout = (Integer) entry.get("connectionTimeout");if (connectionTimeout != null) {builder.withConnectionHttpTimeout(connectionTimeout);diff --git a/solr/core/src/java/org/apache/solr/handler/ExportHandler.java b/solr/core/src/java/org/apache/solr/handler/ExportHandler.javaindex 81288d2f892..304bc12bd30 100644--- a/solr/core/src/java/org/apache/solr/handler/ExportHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/ExportHandler.java@@ -48,7 +48,7 @@ public class ExportHandler extends SearchHandler {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());private ModelCache modelCache = null;- private ConcurrentMap<String,Object> objectCache = new ConcurrentHashMap<>();+ private ConcurrentMap<String, ConcurrentMap<String,Object>> objectCache = new ConcurrentHashMap<>();private SolrDefaultStreamFactory streamFactory = new ExportHandlerStreamFactory();private String coreName;private SolrClientCache solrClientCache;diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.javaindex bca1aa66238..d8976522e91 100644--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java@@ -89,7 +89,7 @@ import static org.apache.solr.common.params.CommonParams.ID;public class StreamHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {private ModelCache modelCache;- private ConcurrentMap<String, Object> objectCache;+ private ConcurrentMap<String, ConcurrentMap<String,Object>> objectCache;private SolrDefaultStreamFactory streamFactory = new SolrDefaultStreamFactory();private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());private String coreName;diff --git a/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java b/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.javaindex 6ae8e157a49..34299116157 100644--- a/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java@@ -284,8 +284,7 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {public Object getFirstValue(String name) {Object v = _fields.get(name);if (v == null || !(v instanceof Collection)) return convertCharSeq(v);- @SuppressWarnings({"rawtypes"})- Collection c = (Collection) v;+ Collection<?> c = (Collection<?>) v;if (c.size() > 0) {return convertCharSeq(c.iterator().next());}diff --git a/solr/core/src/java/org/apache/solr/response/GraphMLResponseWriter.java b/solr/core/src/java/org/apache/solr/response/GraphMLResponseWriter.javaindex 254ea8dabfc..0160e6d153f 100644--- a/solr/core/src/java/org/apache/solr/response/GraphMLResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/GraphMLResponseWriter.java@@ -20,7 +20,6 @@ package org.apache.solr.response;import java.io.IOException;import java.io.PrintWriter;import java.io.Writer;-import java.util.Iterator;import java.util.List;import java.util.ArrayList;@@ -90,9 +89,7 @@ public class GraphMLResponseWriter implements QueryResponseWriter {printWriter.write("<node id=\""+ xmlEscape(id)+"\"");List<String> outfields = new ArrayList<>();- Iterator<Object> keys = tuple.getFields().keySet().iterator();- while(keys.hasNext()) {- String key = String.valueOf(keys.next());+ for (String key : tuple.getFields().keySet()) {if(key.equals("node") || key.equals("ancestors") || key.equals("collection")) {continue;} else {diff --git a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.javaindex c30dddba9cd..e83f9239ff6 100644--- a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java@@ -103,7 +103,7 @@ class ArrayOfNameTypeValueJSONWriter extends JSONWriter {}@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {if (val instanceof SimpleOrderedMap) {super.writeNamedList(name, val);@@ -223,14 +223,14 @@ class ArrayOfNameTypeValueJSONWriter extends JSONWriter {@Override- public void writeMap(String name, @SuppressWarnings({"rawtypes"})Map val,+ public void writeMap(String name, Map<?, ?> val,boolean excludeOuter, boolean isFirstVal) throws IOException {ifNeededWriteTypeAndValueKey("map");super.writeMap(name, val, excludeOuter, isFirstVal);}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ public void writeArray(String name, Iterator<?> val) throws IOException {ifNeededWriteTypeAndValueKey("array");super.writeArray(name, val);}diff --git a/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java b/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.javaindex d09f4f8d124..b10fb3d921f 100644--- a/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java@@ -58,7 +58,7 @@ class PHPWriter extends JSONWriter {}@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {writeNamedListAsMapMangled(name,val);}@@ -78,7 +78,7 @@ class PHPWriter extends JSONWriter {}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})List l) throws IOException {+ public void writeArray(String name, List<?> l) throws IOException {writeArray(name,l.iterator());}diff --git a/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java b/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.javaindex 72f6b79165b..e3d79452c3c 100644--- a/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java@@ -85,7 +85,7 @@ class PHPSerializedWriter extends JSONWriter {}@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {writeNamedListAsMapMangled(name, val);}@@ -179,7 +179,7 @@ class PHPSerializedWriter extends JSONWriter {@Override@SuppressWarnings({"unchecked"})- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ public void writeArray(String name, Iterator<?> val) throws IOException {@SuppressWarnings({"rawtypes"})ArrayList vals = new ArrayList();while( val.hasNext() ) {diff --git a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.javaindex d9f580467a8..7ab424d9cbc 100644--- a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java+++ b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java@@ -22,7 +22,6 @@ import java.util.Arrays;import java.util.Iterator;import java.util.List;import java.util.Map;-import java.util.Set;import org.apache.solr.common.SolrDocument;import org.apache.solr.common.util.NamedList;@@ -307,7 +306,7 @@ public class SchemaXmlWriter extends TextResponseWriter {}@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {// name is ignored - this method is only used for SimilarityFactoryint sz = val.size();for (int i=0; i<sz; i++) {@@ -341,8 +340,7 @@ public class SchemaXmlWriter extends TextResponseWriter {@Override- @SuppressWarnings({"unchecked", "rawtypes"})- public void writeMap(String name, @SuppressWarnings({"rawtypes"})Map map, boolean excludeOuter, boolean isFirstVal) throws IOException {+ public void writeMap(String name, Map<?, ?> map, boolean excludeOuter, boolean isFirstVal) throws IOException {int sz = map.size();if (!excludeOuter) {@@ -350,7 +348,7 @@ public class SchemaXmlWriter extends TextResponseWriter {incLevel();}- for (Map.Entry entry : (Set<Map.Entry>)map.entrySet()) {+ for (Map.Entry<?,?> entry : map.entrySet()) {Object k = entry.getKey();Object v = entry.getValue();// if (sz<indentThreshold) indent();@@ -372,7 +370,7 @@ public class SchemaXmlWriter extends TextResponseWriter {}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator iter) throws IOException {+ public void writeArray(String name, Iterator<?> iter) throws IOException {if( iter.hasNext() ) {startTag("arr", name, false );incLevel();diff --git a/solr/core/src/java/org/apache/solr/response/TabularResponseWriter.java b/solr/core/src/java/org/apache/solr/response/TabularResponseWriter.javaindex e27433520db..065d1150e58 100644--- a/solr/core/src/java/org/apache/solr/response/TabularResponseWriter.java+++ b/solr/core/src/java/org/apache/solr/response/TabularResponseWriter.java@@ -118,7 +118,7 @@ public abstract class TabularResponseWriter extends TextResponseWriter {}@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {}@Override@@ -135,11 +135,11 @@ public abstract class TabularResponseWriter extends TextResponseWriter {}@Override- public void writeMap(String name, @SuppressWarnings({"rawtypes"})Map val, boolean excludeOuter, boolean isFirstVal) throws IOException {+ public void writeMap(String name, Map<?, ?> val, boolean excludeOuter, boolean isFirstVal) {}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ public void writeArray(String name, Iterator<?> val) throws IOException {}@Overridediff --git a/solr/core/src/java/org/apache/solr/response/XMLWriter.java b/solr/core/src/java/org/apache/solr/response/XMLWriter.javaindex 5f7659007aa..e22cb8c5ec7 100644--- a/solr/core/src/java/org/apache/solr/response/XMLWriter.java+++ b/solr/core/src/java/org/apache/solr/response/XMLWriter.java@@ -22,7 +22,6 @@ import java.lang.invoke.MethodHandles;import java.util.Arrays;import java.util.Iterator;import java.util.Map;-import java.util.Set;import org.apache.solr.common.IteratorWriter;import org.apache.solr.common.MapWriter;@@ -236,7 +235,7 @@ public class XMLWriter extends TextResponseWriter {//@Override- public void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ public void writeNamedList(String name, NamedList<?> val) throws IOException {int sz = val.size();startTag("lst", name, sz<=0);@@ -275,8 +274,7 @@ public class XMLWriter extends TextResponseWriter {}@Override- @SuppressWarnings({"unchecked", "rawtypes"})- public void writeMap(String name, @SuppressWarnings({"rawtypes"})Map map, boolean excludeOuter, boolean isFirstVal) throws IOException {+ public void writeMap(String name, Map<?, ?> map, boolean excludeOuter, boolean isFirstVal) throws IOException {int sz = map.size();if (!excludeOuter) {@@ -284,7 +282,7 @@ public class XMLWriter extends TextResponseWriter {incLevel();}- for (Map.Entry entry : (Set<Map.Entry>)map.entrySet()) {+ for (Map.Entry<?,?> entry : map.entrySet()) {Object k = entry.getKey();Object v = entry.getValue();// if (sz<indentThreshold) indent();@@ -306,7 +304,7 @@ public class XMLWriter extends TextResponseWriter {}@Override- public void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator iter) throws IOException {+ public void writeArray(String name, Iterator<?> iter) throws IOException {if( iter.hasNext() ) {startTag("arr", name, false );incLevel();diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.javaindex 45c5806aaae..0c5c3f4f56b 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java@@ -61,7 +61,6 @@ import org.apache.http.util.EntityUtils;import org.apache.lucene.util.TestUtil;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.solrj.SolrClient;-import org.apache.solr.client.solrj.SolrRequest;import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;import org.apache.solr.client.solrj.impl.CloudSolrClient;@@ -268,8 +267,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {return create.process(solrClient);}- @SuppressWarnings({"rawtypes"})- private NamedList getConfigSetPropertiesFromZk(+ private NamedList<Object> getConfigSetPropertiesFromZk(SolrZkClient zkClient, String path) throws Exception {byte [] oldPropsData = null;try {@@ -291,8 +289,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {private void verifyProperties(String configSetName, Map<String, String> oldProps,Map<String, String> newProps, SolrZkClient zkClient) throws Exception {- @SuppressWarnings({"rawtypes"})- NamedList properties = getConfigSetPropertiesFromZk(zkClient,ZkConfigSetService.CONFIGS_ZKNODE + "/" + configSetName + "/" + DEFAULT_FILENAME);+ NamedList<?> properties = getConfigSetPropertiesFromZk(zkClient,ZkConfigSetService.CONFIGS_ZKNODE + "/" + configSetName + "/" + DEFAULT_FILENAME);// let's check without merging the maps, since that's what the MessageHandler does// (since we'd probably repeat any bug in the MessageHandler here)if (oldProps == null && newProps == null) {@@ -315,10 +312,9 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {}// check the value in properties are correct- @SuppressWarnings({"unchecked"})- Iterator<Map.Entry<String, Object>> it = properties.iterator();+ Iterator<? extends Map.Entry<String, ?>> it = properties.iterator();while (it.hasNext()) {- Map.Entry<String, Object> entry = it.next();+ Map.Entry<String, ?> entry = it.next();String newValue = newProps != null ? newProps.get(entry.getKey()) : null;String oldValue = oldProps != null ? oldProps.get(entry.getKey()) : null;if (newValue != null) {@@ -1026,8 +1022,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {params.set("name", collectionName);params.set("numShards", numShards);params.set("replicationFactor", replicationFactor);- @SuppressWarnings({"rawtypes"})- SolrRequest request = new QueryRequest(params);+ QueryRequest request = new QueryRequest(params);request.setPath("/admin/collections");CollectionAdminResponse res = new CollectionAdminResponse();@@ -1129,7 +1124,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {}private void verifyException(SolrClient solrClient,- @SuppressWarnings({"rawtypes"})ConfigSetAdminRequest request,+ ConfigSetAdminRequest<?, ?> request,String errorContains) throws Exception {ignoreException(errorContains);Exception e = expectThrows(Exception.class, () -> solrClient.request(request));@@ -1229,8 +1224,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {}public static class CreateNoErrorChecking extends ConfigSetAdminRequest.Create {- @SuppressWarnings({"rawtypes"})- public ConfigSetAdminRequest setAction(ConfigSetAction action) {+ public ConfigSetAdminRequest<Create, ConfigSetAdminResponse> setAction(ConfigSetAction action) {return super.setAction(action);}@@ -1245,8 +1239,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {}public static class DeleteNoErrorChecking extends ConfigSetAdminRequest.Delete {- @SuppressWarnings({"rawtypes"})- public ConfigSetAdminRequest setAction(ConfigSetAction action) {+ public ConfigSetAdminRequest<Delete, ConfigSetAdminResponse> setAction(ConfigSetAction action) {return super.setAction(action);}diff --git a/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java b/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.javaindex c105191273e..ef4d1fd288c 100644--- a/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java@@ -20,7 +20,6 @@ import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.List;-import java.util.Map;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.LuceneTestCase.Slow;@@ -1852,54 +1851,6 @@ public class TestSQLHandler extends SolrCloudTestCase {}- public boolean assertLong(Tuple tuple, String fieldName, long l) throws Exception {- long lv = (long) tuple.get(fieldName);- if (lv != l) {- throw new Exception("Longs not equal:" + l + " : " + lv);- }-- return true;- }-- public boolean assertString(Tuple tuple, String fieldName, String expected) throws Exception {- String actual = (String) tuple.get(fieldName);-- if ((null == expected && null != actual) ||- (null != expected && null == actual) ||- (null != expected && !expected.equals(actual))) {- throw new Exception("Longs not equal:" + expected + " : " + actual);- }-- return true;- }-- public boolean assertDouble(Tuple tuple, String fieldName, double d) throws Exception {- double dv = tuple.getDouble(fieldName);- if (dv != d) {- throw new Exception("Doubles not equal:" + d + " : " + dv);- }-- return true;- }-- protected boolean assertMaps(@SuppressWarnings({"rawtypes"}) List<Map> maps, int... ids) throws Exception {- if (maps.size() != ids.length) {- throw new Exception("Expected id count != actual map count:" + ids.length + ":" + maps.size());- }-- int i = 0;- for (int val : ids) {- @SuppressWarnings({"rawtypes"})- Map t = maps.get(i);- String tip = (String) t.get("id");- if (!tip.equals(Integer.toString(val))) {- throw new Exception("Found value:" + tip + " expecting:" + val);- }- ++i;- }- return true;- }-protected List<Tuple> getTuples(final SolrParams params, String baseUrl) throws IOException {//log.info("Tuples from params: {}", params);TupleStream tupleStream = new SolrStream(baseUrl, params);diff --git a/solr/core/src/test/org/apache/solr/update/MockingHttp2SolrClient.java b/solr/core/src/test/org/apache/solr/update/MockingHttp2SolrClient.javaindex ab6cf839198..200de4bb08c 100644--- a/solr/core/src/test/org/apache/solr/update/MockingHttp2SolrClient.java+++ b/solr/core/src/test/org/apache/solr/update/MockingHttp2SolrClient.java@@ -123,7 +123,7 @@ public class MockingHttp2SolrClient extends Http2SolrClient {}@Override- public Cancellable asyncRequest(@SuppressWarnings({"rawtypes"}) SolrRequest request,+ public Cancellable asyncRequest(SolrRequest<?> request,String collection, AsyncListener<NamedList<Object>> asyncListener) {if (request instanceof UpdateRequest) {UpdateRequest ur = (UpdateRequest) request;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.javaindex 22e615f9237..f0ff3bf05a8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java@@ -88,16 +88,14 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl/**If set to true, every request that implements {@link V2RequestSupport} will be converted* to a V2 API call*/- @SuppressWarnings({"rawtypes"})- public SolrRequest setUseV2(boolean flag){+ public SolrRequest<T> setUseV2(boolean flag){this.usev2 = flag;return this;}/**If set to true use javabin instead of json (default)*/- @SuppressWarnings({"rawtypes"})- public SolrRequest setUseBinaryV2(boolean flag){+ public SolrRequest<T> setUseBinaryV2(boolean flag){this.useBinaryV2 = flag;return this;}@@ -106,8 +104,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializablprivate String basePath;- @SuppressWarnings({"rawtypes"})- public SolrRequest setBasicAuthCredentials(String user, String password) {+ public SolrRequest<T> setBasicAuthCredentials(String user, String password) {this.basicAuthUser = user;this.basicAuthPwd = password;return this;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrResponse.javaindex 43955d83b2a..620b1a4a103 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrResponse.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrResponse.java@@ -55,8 +55,7 @@ public abstract class SolrResponse implements Serializable, MapWriter {}public Exception getException() {- @SuppressWarnings({"rawtypes"})- NamedList exp = (NamedList) getResponse().get("exception");+ NamedList<?> exp = (NamedList<?>) getResponse().get("exception");if (exp == null) {return null;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.javaindex 68b341022a9..dc84b056fa8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java@@ -104,8 +104,7 @@ public class DocumentObjectBinder {Object val = field.get(obj);if (val == null) return;if (val instanceof Collection) {- @SuppressWarnings({"rawtypes"})- Collection collection = (Collection) val;+ Collection<?> collection = (Collection<?>) val;for (Object o : collection) {SolrInputDocument child = toSolrInputDocument(o);doc.addChildDocument(child);@@ -327,13 +326,12 @@ public class DocumentObjectBinder {* Returns <code>SolrDocument.getFieldValue</code> for regular fields,* and <code>Map<String, List<Object>></code> for a dynamic field. The key is all matching fieldName's.*/- @SuppressWarnings({"unchecked", "rawtypes"})private Object getFieldValue(SolrDocument solrDocument) {if (child != null) {List<SolrDocument> children = solrDocument.getChildDocuments();if (children == null || children.isEmpty()) return null;if (isList) {- ArrayList list = new ArrayList(children.size());+ ArrayList<Object> list = new ArrayList<>(children.size());for (SolrDocument c : children) {list.add(getBean(type, child, c));}@@ -361,11 +359,11 @@ public class DocumentObjectBinder {//reading dynamic field valuesMap<String, Object> allValuesMap = null;- List allValuesList = null;+ List<Object> allValuesList = null;if (isContainedInMap) {allValuesMap = new HashMap<>();} else {- allValuesList = new ArrayList();+ allValuesList = new ArrayList<>();}for (String field : solrDocument.getFieldNames()) {@@ -378,7 +376,7 @@ public class DocumentObjectBinder {if (isContainedInMap) {if (isList) {if (!(val instanceof List)) {- List al = new ArrayList();+ List<Object> al = new ArrayList<>();al.add(val);val = al;}@@ -394,7 +392,7 @@ public class DocumentObjectBinder {allValuesMap.put(field, val);} else {if (val instanceof Collection) {- allValuesList.addAll((Collection) val);+ allValuesList.addAll((Collection<?>) val);} else {allValuesList.add(val);}@@ -408,7 +406,6 @@ public class DocumentObjectBinder {}}- @SuppressWarnings({"unchecked", "rawtypes"})<T> void inject(T obj, SolrDocument sdoc) {Object val = getFieldValue(sdoc);if(val == null) {@@ -416,20 +413,19 @@ public class DocumentObjectBinder {}if (isArray && !isContainedInMap) {- List list;+ List<?> list;if (val.getClass().isArray()) {set(obj, val);return;} else if (val instanceof List) {- list = (List) val;+ list = (List<?>) val;} else {- list = new ArrayList();- list.add(val);+ list = Collections.singletonList(val);}set(obj, list.toArray((Object[]) Array.newInstance(type, list.size())));} else if (isList && !isContainedInMap) {if (!(val instanceof List)) {- List list = new ArrayList();+ List<Object> list = new ArrayList<>();list.add(val);val = list;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.javaindex 17638957914..f19928b7de4 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java@@ -687,8 +687,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {return urlMap;}- @SuppressWarnings({"unchecked", "rawtypes"})- protected <T extends RouteResponse> T condenseResponse(NamedList response, int timeMillis, Supplier<T> supplier) {+ protected <T extends RouteResponse<?>> T condenseResponse(NamedList<?> response, int timeMillis, Supplier<T> supplier) {T condensed = supplier.get();int status = 0;Integer rf = null;@@ -698,11 +697,11 @@ public abstract class BaseCloudSolrClient extends SolrClient {int maxToleratedErrors = Integer.MAX_VALUE;// For "adds", "deletes", "deleteByQuery" etc.- Map<String, NamedList> versions = new HashMap<>();+ Map<String, NamedList<Object>> versions = new HashMap<>();for(int i=0; i<response.size(); i++) {- NamedList shardResponse = (NamedList)response.getVal(i);- NamedList header = (NamedList)shardResponse.get("responseHeader");+ NamedList<?> shardResponse = (NamedList<?>)response.getVal(i);+ NamedList<?> header = (NamedList<?>)shardResponse.get("responseHeader");Integer shardStatus = (Integer)header.get("status");int s = shardStatus.intValue();if(s > 0) {@@ -715,6 +714,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {rf = routeRf;}+ @SuppressWarnings("unchecked")List<SimpleOrderedMap<String>> shardTolerantErrors =(List<SimpleOrderedMap<String>>) header.get("errors");if (null != shardTolerantErrors) {@@ -735,15 +735,16 @@ public abstract class BaseCloudSolrClient extends SolrClient {for (String updateType: Arrays.asList("adds", "deletes", "deleteByQuery")) {Object obj = shardResponse.get(updateType);if (obj instanceof NamedList) {- NamedList versionsList = versions.containsKey(updateType) ?- versions.get(updateType): new NamedList();- versionsList.addAll((NamedList)obj);+ NamedList<Object> versionsList = versions.containsKey(updateType) ?+ versions.get(updateType): new NamedList<>();+ NamedList<?> nl = (NamedList<?>) obj;+ versionsList.addAll(nl);versions.put(updateType, versionsList);}}}- NamedList cheader = new NamedList();+ NamedList<Object> cheader = new NamedList<>();cheader.add("status", status);cheader.add("QTime", timeMillis);if (rf != null)@@ -760,7 +761,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {StringBuilder msgBuf = new StringBuilder().append(toleratedErrors.size()).append(" Async failures during distributed update: ");- NamedList metadata = new NamedList<String>();+ NamedList<String> metadata = new NamedList<>();for (SimpleOrderedMap<String> err : toleratedErrors) {ToleratedUpdateError te = ToleratedUpdateError.parseMap(err);metadata.add(te.getMetadataKey(), te.getMetadataValue());@@ -773,7 +774,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {throw toThrow;}}- for (Map.Entry<String, NamedList> entry : versions.entrySet()) {+ for (Map.Entry<String, NamedList<Object>> entry : versions.entrySet()) {condensed.add(entry.getKey(), entry.getValue());}condensed.add("responseHeader", cheader);@@ -781,22 +782,20 @@ public abstract class BaseCloudSolrClient extends SolrClient {}@SuppressWarnings({"rawtypes"})- public RouteResponse condenseResponse(NamedList response, int timeMillis) {+ public RouteResponse condenseResponse(NamedList<?> response, int timeMillis) {return condenseResponse(response, timeMillis, RouteResponse::new);}@SuppressWarnings({"rawtypes"})- public static class RouteResponse<T extends LBSolrClient.Req> extends NamedList {- @SuppressWarnings({"rawtypes"})- private NamedList routeResponses;+ public static class RouteResponse<T extends LBSolrClient.Req> extends NamedList<Object> {+ private NamedList<NamedList<?>> routeResponses;private Map<String, T> routes;- public void setRouteResponses(@SuppressWarnings({"rawtypes"})NamedList routeResponses) {+ public void setRouteResponses(NamedList<NamedList<?>> routeResponses) {this.routeResponses = routeResponses;}- @SuppressWarnings({"rawtypes"})- public NamedList getRouteResponses() {+ public NamedList<NamedList<?>> getRouteResponses() {return routeResponses;}@@ -929,11 +928,8 @@ public abstract class BaseCloudSolrClient extends SolrClient {if(o != null && o instanceof Map) {//remove this because no one else needs this and tests would fail if they are comparing responsesresp.remove(resp.size()-1);- @SuppressWarnings({"rawtypes"})- Map invalidStates = (Map) o;- for (Object invalidEntries : invalidStates.entrySet()) {- @SuppressWarnings({"rawtypes"})- Map.Entry e = (Map.Entry) invalidEntries;+ Map<?,?> invalidStates = (Map<?,?>) o;+ for (Map.Entry<?,?> e : invalidStates.entrySet()) {getDocCollection((String) e.getKey(), (Integer) e.getValue());}@@ -1223,8 +1219,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {//it is readily available just return itreturn ref.get();}- @SuppressWarnings({"rawtypes"})- List locks = this.locks;+ List<Object> locks = this.locks;final Object lock = locks.get(Math.abs(Hash.murmurhash3_x86_32(collection, 0, collection.length(), 0) % locks.size()));DocCollection fetchedCol = null;synchronized (lock) {@@ -1258,10 +1253,9 @@ public abstract class BaseCloudSolrClient extends SolrClient {* all shards involved in processing an update request, typically useful* for gauging the replication factor of a batch.*/- @SuppressWarnings("rawtypes")- public int getMinAchievedReplicationFactor(String collection, NamedList resp) {+ public int getMinAchievedReplicationFactor(String collection, NamedList<?> resp) {// it's probably already on the top-level header set by condense- NamedList header = (NamedList)resp.get("responseHeader");+ NamedList<?> header = (NamedList<?>)resp.get("responseHeader");Integer achRf = (Integer)header.get(UpdateRequest.REPFACT);if (achRf != null)return achRf.intValue();@@ -1281,15 +1275,14 @@ public abstract class BaseCloudSolrClient extends SolrClient {* the replication factor that was achieved in each shard involved in the request.* For single doc updates, there will be only one shard in the return value.*/- @SuppressWarnings({"unchecked", "rawtypes"})- public Map<String,Integer> getShardReplicationFactor(String collection, NamedList resp) {+ public Map<String,Integer> getShardReplicationFactor(String collection, NamedList<?> resp) {connect();- Map<String,Integer> results = new HashMap<String,Integer>();+ Map<String,Integer> results = new HashMap<>();if (resp instanceof RouteResponse) {- NamedList routes = ((RouteResponse)resp).getRouteResponses();+ NamedList<NamedList<?>> routes = ((RouteResponse<?>)resp).getRouteResponses();DocCollection coll = getDocCollection(collection, null);- Map<String,String> leaders = new HashMap<String,String>();+ Map<String,String> leaders = new HashMap<>();for (Slice slice : coll.getActiveSlicesArr()) {Replica leader = slice.getLeader();if (leader != null) {@@ -1301,13 +1294,12 @@ public abstract class BaseCloudSolrClient extends SolrClient {}}- @SuppressWarnings({"unchecked"})- Iterator<Map.Entry<String,Object>> routeIter = routes.iterator();+ Iterator<Map.Entry<String,NamedList<?>>> routeIter = routes.iterator();while (routeIter.hasNext()) {- Map.Entry<String,Object> next = routeIter.next();+ Map.Entry<String,NamedList<?>> next = routeIter.next();String host = next.getKey();- NamedList hostResp = (NamedList)next.getValue();- Integer rf = (Integer)((NamedList)hostResp.get("responseHeader")).get(UpdateRequest.REPFACT);+ NamedList<?> hostResp = next.getValue();+ Integer rf = (Integer)((NamedList<?>)hostResp.get("responseHeader")).get(UpdateRequest.REPFACT);if (rf != null) {String shard = leaders.get(host);if (shard == null) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.javaindex 5f792066507..22c133f0e24 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java@@ -108,7 +108,7 @@ public abstract class BaseHttpClusterStateProvider implements ClusterStateProvid+ " solrUrl(s) or zkHost(s).");}- @SuppressWarnings({"rawtypes", "unchecked"})+ @SuppressWarnings("unchecked")private ClusterState fetchClusterState(SolrClient client, String collection, Map<String, Object> clusterProperties) throws SolrServerException, IOException, NotACollectionException {ModifiableSolrParams params = new ModifiableSolrParams();if (collection != null) {@@ -117,13 +117,13 @@ public abstract class BaseHttpClusterStateProvider implements ClusterStateProvidparams.set("action", "CLUSTERSTATUS");QueryRequest request = new QueryRequest(params);request.setPath("/admin/collections");- NamedList cluster = (SimpleOrderedMap) client.request(request).get("cluster");+ SimpleOrderedMap<?> cluster = (SimpleOrderedMap<?>) client.request(request).get("cluster");Map<String, Object> collectionsMap;if (collection != null) {collectionsMap = Collections.singletonMap(collection,- ((NamedList) cluster.get("collections")).get(collection));+ ((NamedList<?>) cluster.get("collections")).get(collection));} else {- collectionsMap = ((NamedList)cluster.get("collections")).asMap(10);+ collectionsMap = ((NamedList<?>)cluster.get("collections")).asMap(10);}int znodeVersion;Map<String, Object> collFromStatus = (Map<String, Object>) (collectionsMap).get(collection);@@ -135,7 +135,7 @@ public abstract class BaseHttpClusterStateProvider implements ClusterStateProvid} else {znodeVersion = -1;}- Set<String> liveNodes = new HashSet((List<String>)(cluster.get("live_nodes")));+ Set<String> liveNodes = new HashSet<>((List<String>)(cluster.get("live_nodes")));this.liveNodes = liveNodes;liveNodesTimestamp = System.nanoTime();ClusterState cs = ClusterState.createFromCollectionMap(znodeVersion, collectionsMap, liveNodes);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.javaindex b260e140f06..8dcf3d9ceb5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java@@ -49,16 +49,15 @@ public abstract class BaseHttpSolrClient extends SolrClient {* it sends a proper payload back to the client*/public static class RemoteExecutionException extends RemoteSolrException {- @SuppressWarnings({"rawtypes"})- private NamedList meta;+ private NamedList<?> meta;- public RemoteExecutionException(String remoteHost, int code, String msg, @SuppressWarnings({"rawtypes"})NamedList meta) {+ public RemoteExecutionException(String remoteHost, int code, String msg, NamedList<?> meta) {super(remoteHost, code, msg + (meta != null ? ": " + meta : ""), null);this.meta = meta;}- public static RemoteExecutionException create(String host, @SuppressWarnings({"rawtypes"})NamedList errResponse) {+ public static RemoteExecutionException create(String host, NamedList<?> errResponse) {Object errObj = errResponse.get("error");if (errObj != null) {Number code = (Number) getObjectByPath(errObj, true, Collections.singletonList("code"));@@ -72,9 +71,7 @@ public abstract class BaseHttpSolrClient extends SolrClient {}- @SuppressWarnings({"rawtypes"})- public NamedList getMetaData() {-+ public NamedList<?> getMetaData() {return meta;}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.javaindex 9906ddf4cc2..1fcd72ef601 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java@@ -39,7 +39,7 @@ import static org.apache.solr.common.params.CommonParams.JAVABIN_MIME;public class BinaryRequestWriter extends RequestWriter {@Override- public ContentWriter getContentWriter(@SuppressWarnings({"rawtypes"})SolrRequest req) {+ public ContentWriter getContentWriter(SolrRequest<?> req) {if (req instanceof UpdateRequest) {UpdateRequest updateRequest = (UpdateRequest) req;if (isEmpty(updateRequest)) return null;@@ -60,7 +60,7 @@ public class BinaryRequestWriter extends RequestWriter {}@Override- public Collection<ContentStream> getContentStreams(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {+ public Collection<ContentStream> getContentStreams(SolrRequest<?> req) throws IOException {if (req instanceof UpdateRequest) {UpdateRequest updateRequest = (UpdateRequest) req;if (isEmpty(updateRequest) ) return null;@@ -77,7 +77,7 @@ public class BinaryRequestWriter extends RequestWriter {}@Override- public void write(@SuppressWarnings({"rawtypes"})SolrRequest request, OutputStream os) throws IOException {+ public void write(SolrRequest<?> request, OutputStream os) throws IOException {if (request instanceof UpdateRequest) {UpdateRequest updateRequest = (UpdateRequest) request;new JavaBinUpdateRequestCodec().marshal(updateRequest, os);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.javaindex cb9e7c2e80c..e5d1a342d30 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java@@ -43,7 +43,6 @@ import org.apache.solr.common.util.NamedList;* 'id' - if this is not the case, you must set the right name* with {@link #setIdField(String)}.*/-@SuppressWarnings("serial")public class CloudSolrClient extends BaseCloudSolrClient {private final ClusterStateProvider stateProvider;@@ -135,7 +134,7 @@ public class CloudSolrClient extends BaseCloudSolrClient {* @deprecated since Solr 8.0*/@Deprecated- public RouteResponse condenseResponse(@SuppressWarnings({"rawtypes"})NamedList response, int timeMillis) {+ public RouteResponse condenseResponse(NamedList<?> response, int timeMillis) {return condenseResponse(response, timeMillis, RouteResponse::new);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.javaindex a1334cbf1c3..a705121a884 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java@@ -346,7 +346,7 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {}@Override- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)+ public NamedList<Object> request(final SolrRequest<?> request, String collection)throws SolrServerException, IOException {if (!(request instanceof UpdateRequest)) {request.setBasePath(basePath);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.javaindex 2d0b75d3940..94bd8671074 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java@@ -483,7 +483,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {}@Override- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)+ public NamedList<Object> request(final SolrRequest<?> request, String collection)throws SolrServerException, IOException {if (!(request instanceof UpdateRequest)) {return client.request(request, collection);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.javaindex 25792aed65b..91021fc1653 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java@@ -88,7 +88,7 @@ public class DelegationTokenHttpSolrClient extends HttpSolrClient {}@Override- protected HttpRequestBase createMethod(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection) throws IOException, SolrServerException {+ protected HttpRequestBase createMethod(final SolrRequest<?> request, String collection) throws IOException, SolrServerException {SolrParams params = request.getParams();if (params != null && params.getParams(DELEGATION_TOKEN_PARAM) != null) {throw new IllegalArgumentException(DELEGATION_TOKEN_PARAM + " parameter not supported");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.javaindex 1ddf4efd918..d51114754d8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java@@ -261,7 +261,7 @@ public class Http2SolrClient extends SolrClient {assert ObjectReleaseTracker.release(this);}- public boolean isV2ApiRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request) {+ public boolean isV2ApiRequest(final SolrRequest<?> request) {return request instanceof V2Request || request.getPath().contains("/____v2");}@@ -285,7 +285,7 @@ public class Http2SolrClient extends SolrClient {this.isXml = isXml;}- boolean belongToThisStream(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection) {+ boolean belongToThisStream(SolrRequest<?> solrRequest, String collection) {ModifiableSolrParams solrParams = new ModifiableSolrParams(solrRequest.getParams());if (!origParams.toNamedList().equals(solrParams.toNamedList()) || !StringUtils.equals(origCollection, collection)) {return false;@@ -353,7 +353,7 @@ public class Http2SolrClient extends SolrClient {return outStream;}- public void send(OutStream outStream, @SuppressWarnings({"rawtypes"})SolrRequest req, String collection) throws IOException {+ public void send(OutStream outStream, SolrRequest<?> req, String collection) throws IOException {assert outStream.belongToThisStream(req, collection);this.requestWriter.write(req, outStream.outProvider.getOutputStream());if (outStream.isXml) {@@ -381,7 +381,7 @@ public class Http2SolrClient extends SolrClient {private static final Exception CANCELLED_EXCEPTION = new Exception();private static final Cancellable FAILED_MAKING_REQUEST_CANCELLABLE = () -> {};- public Cancellable asyncRequest(@SuppressWarnings({"rawtypes"}) SolrRequest solrRequest, String collection, AsyncListener<NamedList<Object>> asyncListener) {+ public Cancellable asyncRequest(SolrRequest<?> solrRequest, String collection, AsyncListener<NamedList<Object>> asyncListener) {Request req;try {req = makeRequest(solrRequest, collection);@@ -426,7 +426,7 @@ public class Http2SolrClient extends SolrClient {}@Override- public NamedList<Object> request(@SuppressWarnings({"rawtypes"}) SolrRequest solrRequest, String collection) throws SolrServerException, IOException {+ public NamedList<Object> request(SolrRequest<?> solrRequest, String collection) throws SolrServerException, IOException {Request req = makeRequest(solrRequest, collection);final ResponseParser parser = solrRequest.getResponseParser() == null? this.parser: solrRequest.getResponseParser();@@ -460,7 +460,7 @@ public class Http2SolrClient extends SolrClient {}}- private NamedList<Object> processErrorsAndResponse(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest,+ private NamedList<Object> processErrorsAndResponse(SolrRequest<?> solrRequest,ResponseParser parser, Response response, InputStream is) throws SolrServerException {ContentType contentType = getContentType(response);String mimeType = null;@@ -477,7 +477,7 @@ public class Http2SolrClient extends SolrClient {return StringUtils.isEmpty(contentType)? null : ContentType.parse(contentType);}- private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, Request req) {+ private void setBasicAuthHeader(SolrRequest<?> solrRequest, Request req) {if (solrRequest.getBasicAuthUser() != null && solrRequest.getBasicAuthPassword() != null) {String encoded = basicAuthCredentialsToAuthorizationString(solrRequest.getBasicAuthUser(), solrRequest.getBasicAuthPassword());req.header("Authorization", encoded);@@ -491,14 +491,14 @@ public class Http2SolrClient extends SolrClient {return "Basic " + Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET));}- private Request makeRequest(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection)+ private Request makeRequest(SolrRequest<?> solrRequest, String collection)throws SolrServerException, IOException {Request req = createRequest(solrRequest, collection);decorateRequest(req, solrRequest);return req;}- private void decorateRequest(Request req, @SuppressWarnings({"rawtypes"})SolrRequest solrRequest) {+ private void decorateRequest(Request req, SolrRequest<?> solrRequest) {req.header(HttpHeader.ACCEPT_ENCODING, null);req.timeout(idleTimeout, TimeUnit.MILLISECONDS);if (solrRequest.getUserPrincipal() != null) {@@ -513,7 +513,6 @@ public class Http2SolrClient extends SolrClient {req.onComplete(listener);}- @SuppressWarnings({"unchecked"})Map<String, String> headers = solrRequest.getHeaders();if (headers != null) {for (Map.Entry<String, String> entry : headers.entrySet()) {@@ -528,8 +527,7 @@ public class Http2SolrClient extends SolrClient {return new URL(oldURL.getProtocol(), oldURL.getHost(), oldURL.getPort(), newPath).toString();}- @SuppressWarnings({"unchecked"})- private Request createRequest(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection) throws IOException, SolrServerException {+ private Request createRequest(SolrRequest<?> solrRequest, String collection) throws IOException, SolrServerException {if (solrRequest.getBasePath() == null && serverBaseUrl == null)throw new IllegalArgumentException("Destination node is not provided!");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.javaindex e95c5d0d315..4c33d05c69c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java@@ -242,7 +242,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {* org.apache.solr.client.solrj.ResponseParser)*/@Override- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)+ public NamedList<Object> request(final SolrRequest<?> request, String collection)throws SolrServerException, IOException {ResponseParser responseParser = request.getResponseParser();if (responseParser == null) {@@ -251,16 +251,15 @@ public class HttpSolrClient extends BaseHttpSolrClient {return request(request, responseParser, collection);}- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {+ public NamedList<Object> request(final SolrRequest<?> request, final ResponseParser processor) throws SolrServerException, IOException {return request(request, processor, null);}- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor, String collection)+ public NamedList<Object> request(final SolrRequest<?> request, final ResponseParser processor, String collection)throws SolrServerException, IOException {HttpRequestBase method = createMethod(request, collection);setBasicAuthHeader(request, method);if (request.getHeaders() != null) {- @SuppressWarnings({"unchecked"})Map<String, String> headers = request.getHeaders();for (Map.Entry<String, String> entry : headers.entrySet()) {method.setHeader(entry.getKey(), entry.getValue());@@ -269,11 +268,11 @@ public class HttpSolrClient extends BaseHttpSolrClient {return executeMethod(method, request.getUserPrincipal(), processor, isV2ApiRequest(request));}- private boolean isV2ApiRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request) {+ private boolean isV2ApiRequest(final SolrRequest<?> request) {return request instanceof V2Request || request.getPath().contains("/____v2");}- private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException {+ private void setBasicAuthHeader(SolrRequest<?> request, HttpRequestBase method) throws UnsupportedEncodingException {if (request.getBasicAuthUser() != null && request.getBasicAuthPassword() != null) {String userPass = request.getBasicAuthUser() + ":" + request.getBasicAuthPassword();String encoded = Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET));@@ -292,7 +291,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {/*** @lucene.experimental*/- public HttpUriRequestResponse httpUriRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request)+ public HttpUriRequestResponse httpUriRequest(final SolrRequest<?> request)throws SolrServerException, IOException {ResponseParser responseParser = request.getResponseParser();if (responseParser == null) {@@ -304,7 +303,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {/*** @lucene.experimental*/- public HttpUriRequestResponse httpUriRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {+ public HttpUriRequestResponse httpUriRequest(final SolrRequest<?> request, final ResponseParser processor) throws SolrServerException, IOException {HttpUriRequestResponse mrr = new HttpUriRequestResponse();final HttpRequestBase method = createMethod(request, null);ExecutorService pool = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrNamedThreadFactory("httpUriRequest"));@@ -344,8 +343,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {return new URL(oldURL.getProtocol(), oldURL.getHost(), oldURL.getPort(), newPath).toString();}- @SuppressWarnings({"unchecked"})- protected HttpRequestBase createMethod(@SuppressWarnings({"rawtypes"})SolrRequest request, String collection) throws IOException, SolrServerException {+ protected HttpRequestBase createMethod(SolrRequest<?> request, String collection) throws IOException, SolrServerException {if (request instanceof V2RequestSupport) {request = ((V2RequestSupport) request).getV2Request();}@@ -488,7 +486,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {}private HttpEntityEnclosingRequestBase fillContentStream(- @SuppressWarnings({"rawtypes"})SolrRequest request,+ SolrRequest<?> request,Collection<ContentStream> streams, ModifiableSolrParams wparams,boolean isMultipart, LinkedList<NameValuePair> postOrPutParams,String fullQueryUrl) throws IOException {@@ -732,7 +730,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {return false;}- private Header[] buildRequestSpecificHeaders(@SuppressWarnings({"rawtypes"}) final SolrRequest request) {+ private Header[] buildRequestSpecificHeaders(final SolrRequest<?> request) {Header[] contextHeaders = new Header[2];//TODO: validate request context here: https://issues.apache.org/jira/browse/SOLR-14720diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.javaindex 43ca73ec162..25b3d104032 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java@@ -212,8 +212,7 @@ public class Krb5HttpClientBuilder implements HttpClientBuilderFactory {private javax.security.auth.login.Configuration baseConfig;// the com.sun.security.jgss appNames- @SuppressWarnings({"unchecked", "rawtypes"})- private Set<String> initiateAppNames = new HashSet(+ private Set<String> initiateAppNames = new HashSet<>(Arrays.asList("com.sun.security.jgss.krb5.initiate", "com.sun.security.jgss.initiate"));public SolrJaasConfiguration() {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.javaindex 9fe39a32585..30ffed3c5e8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java@@ -234,25 +234,23 @@ public abstract class LBSolrClient extends SolrClient {// Req should be parameterized too, but that touches a whole lotta codepublic static class Req {- @SuppressWarnings({"rawtypes"})- protected SolrRequest request;+ protected SolrRequest<?> request;protected List<String> servers;protected int numDeadServersToTry;private final Integer numServersToTry;- public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers) {+ public Req(SolrRequest<?> request, List<String> servers) {this(request, servers, null);}- public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers, Integer numServersToTry) {+ public Req(SolrRequest<?> request, List<String> servers, Integer numServersToTry) {this.request = request;this.servers = servers;this.numDeadServersToTry = servers.size();this.numServersToTry = numServersToTry;}- @SuppressWarnings({"rawtypes"})- public SolrRequest getRequest() {+ public SolrRequest<?> getRequest() {return request;}public List<String> getServers() {@@ -372,7 +370,7 @@ public abstract class LBSolrClient extends SolrClient {/*** @return time allowed in nanos, returns -1 if no time_allowed is specified.*/- private static long getTimeAllowedInNanos(@SuppressWarnings({"rawtypes"})final SolrRequest req) {+ private static long getTimeAllowedInNanos(final SolrRequest<?> req) {SolrParams reqParams = req.getParams();return reqParams == null ? -1 :TimeUnit.NANOSECONDS.convert(reqParams.getInt(CommonParams.TIME_ALLOWED, -1), TimeUnit.MILLISECONDS);@@ -599,12 +597,12 @@ public abstract class LBSolrClient extends SolrClient {* @throws IOException If there is a low-level I/O error.*/@Override- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)+ public NamedList<Object> request(final SolrRequest<?> request, String collection)throws SolrServerException, IOException {return request(request, collection, null);}- public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection,+ public NamedList<Object> request(final SolrRequest<?> request, String collection,final Integer numServersToTry) throws SolrServerException, IOException {Exception ex = null;ServerWrapper[] serverList = aliveServerList;@@ -701,8 +699,7 @@ public abstract class LBSolrClient extends SolrClient {* @param request the request will be sent to the picked server* @return the picked server*/- protected ServerWrapper pickServer(ServerWrapper[] aliveServerList,- @SuppressWarnings({"rawtypes"})SolrRequest request) {+ protected ServerWrapper pickServer(ServerWrapper[] aliveServerList, SolrRequest<?> request) {int count = counter.incrementAndGet() & Integer.MAX_VALUE;return aliveServerList[count % aliveServerList.length];}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.javaindex c6d3622a09a..36b5f81eec5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java@@ -311,8 +311,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter@Override- @SuppressWarnings({"rawtypes"})- public Map getZkJson(String path) throws KeeperException, InterruptedException {+ public Map<?,?> getZkJson(String path) throws KeeperException, InterruptedException {return Utils.getJson(zkClientClusterStateProvider.getZkStateReader().getZkClient(), path, true);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.javaindex 75609090e6a..9e458da9467 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java@@ -101,8 +101,7 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser {EntryImpl entry = (EntryImpl) e;if( !entry.type().isContainer) return;if (e.isKeyValEntry() && entry.getTag() == Tag._SOLRDOCLST) {- @SuppressWarnings({"rawtypes"})- List l = (List) e.metadata();+ List<?> l = (List<?>) e.metadata();e.listenContainer(fastCallback.initDocList((Long) l.get(0),(Long) l.get(1),@@ -145,8 +144,7 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser {@Overridepublic SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException {SolrDocumentList solrDocs = new SolrDocumentList();- @SuppressWarnings({"rawtypes"})- List list = (List) readVal(dis);+ List<?> list = (List<?>) readVal(dis);solrDocs.setNumFound((Long) list.get(0));solrDocs.setStart((Long) list.get(1));solrDocs.setMaxScore((Float) list.get(2));diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.javaindex 3f101db6fcb..3e624165268 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java@@ -35,7 +35,6 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;-@SuppressWarnings({"unchecked"})public class ZkClientClusterStateProvider implements ClusterStateProvider {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());@@ -104,6 +103,7 @@ public class ZkClientClusterStateProvider implements ClusterStateProvider {return props.get(propertyName);}+ @SuppressWarnings("unchecked")@Overridepublic <T> T getClusterProperty(String propertyName, T def) {Map<String, Object> props = getZkStateReader().getClusterProperties();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ClassificationEvaluation.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ClassificationEvaluation.javaindex 0096f55e320..e036f094f3a 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ClassificationEvaluation.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ClassificationEvaluation.java@@ -36,28 +36,26 @@ public class ClassificationEvaluation {}}- @SuppressWarnings({"unchecked"})- public void putToMap(@SuppressWarnings({"rawtypes"})Map map) {+ public void putToMap(Map<? super String, ? super Long> map) {map.put("truePositive_i",truePositive);map.put("trueNegative_i",trueNegative);map.put("falsePositive_i",falsePositive);map.put("falseNegative_i",falseNegative);}- @SuppressWarnings({"rawtypes"})- public Map toMap() {- HashMap map = new HashMap();+ public Map<String, Long> toMap() {+ HashMap<String, Long> map = new HashMap<>();putToMap(map);return map;}- public static ClassificationEvaluation create(@SuppressWarnings({"rawtypes"})Map map) {+ public static ClassificationEvaluation create(Map<String, ?> map) {ClassificationEvaluation evaluation = new ClassificationEvaluation();evaluation.addEvaluation(map);return evaluation;}- public void addEvaluation(@SuppressWarnings({"rawtypes"})Map map) {+ public void addEvaluation(Map<String, ?> map) {this.truePositive += (long) map.get("truePositive_i");this.trueNegative += (long) map.get("trueNegative_i");this.falsePositive += (long) map.get("falsePositive_i");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.javaindex 9de5e80f94e..7cd5e2a13c6 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java@@ -55,7 +55,7 @@ public class Tuple implements Cloneable, MapWriter {* @deprecated use {@link #getFields()} instead of this public field.*/@Deprecated- public Map<Object, Object> fields = new HashMap<>(2);+ public Map<String, Object> fields = new HashMap<>(2);/*** External serializable field names.* @deprecated use {@link #getFieldNames()} instead of this public field.@@ -73,42 +73,32 @@ public class Tuple implements Cloneable, MapWriter {// just an empty tuple}+ public Tuple(String k1, Object v1) {+ if (k1 != null) put(k1, v1);+ }++ public Tuple(String k1, Object v1, String k2, Object v2) {+ if (k1 != null) put(k1, v1);+ if (k2 != null) put(k2, v2);+ }+/*** A copy constructor.* @param fields map containing keys and values to be copied to this tuple*/- public Tuple(Map<?, ?> fields) {- for (Map.Entry<?, ?> entry : fields.entrySet()) {+ public Tuple(Map<String, ?> fields) {+ // TODO Use bulk putAll operation that will properly size the map+ // https://issues.apache.org/jira/browse/SOLR-15480+ for (Map.Entry<String, ?> entry : fields.entrySet()) {put(entry.getKey(), entry.getValue());}}- /**- * Constructor that accepts an even number of arguments as key / value pairs.- * @param fields a list of key / value pairs, with keys at odd and values at- * even positions.- */- public Tuple(Object... fields) {- if (fields == null) {- return;- }- if ((fields.length % 2) != 0) {- throw new RuntimeException("must have a matching number of key-value pairs");- }- for (int i = 0; i < fields.length; i += 2) {- // skip empty entries- if (fields[i] == null) {- continue;- }- put(fields[i], fields[i + 1]);- }- }-- public Object get(Object key) {+ public Object get(String key) {return this.fields.get(key);}- public void put(Object key, Object value) {+ public void put(String key, Object value) {this.fields.put(key, value);if (key.equals(StreamParams.EOF)) {EOF = true;@@ -117,17 +107,17 @@ public class Tuple implements Cloneable, MapWriter {}}- public void remove(Object key) {+ public void remove(String key) {this.fields.remove(key);}- public String getString(Object key) {+ public String getString(String key) {return String.valueOf(this.fields.get(key));}public String getException() { return (String)this.fields.get(StreamParams.EXCEPTION); }- public Long getLong(Object key) {+ public Long getLong(String key) {Object o = this.fields.get(key);if (o == null) {@@ -145,7 +135,7 @@ public class Tuple implements Cloneable, MapWriter {}// Convenience method since Booleans can be passed around as Strings.- public Boolean getBool(Object key) {+ public Boolean getBool(String key) {Object o = this.fields.get(key);if (o == null) {@@ -161,12 +151,12 @@ public class Tuple implements Cloneable, MapWriter {}@SuppressWarnings({"unchecked"})- public List<Boolean> getBools(Object key) {+ public List<Boolean> getBools(String key) {return (List<Boolean>) this.fields.get(key);}// Convenience methods since the dates are actually shipped around as Strings.- public Date getDate(Object key) {+ public Date getDate(String key) {Object o = this.fields.get(key);if (o == null) {@@ -182,7 +172,7 @@ public class Tuple implements Cloneable, MapWriter {}@SuppressWarnings({"unchecked"})- public List<Date> getDates(Object key) {+ public List<Date> getDates(String key) {List<String> vals = (List<String>) this.fields.get(key);if (vals == null) return null;@@ -193,7 +183,7 @@ public class Tuple implements Cloneable, MapWriter {return ret;}- public Double getDouble(Object key) {+ public Double getDouble(String key) {Object o = this.fields.get(key);if (o == null) {@@ -209,24 +199,24 @@ public class Tuple implements Cloneable, MapWriter {}@SuppressWarnings({"unchecked"})- public List<String> getStrings(Object key) {+ public List<String> getStrings(String key) {return (List<String>)this.fields.get(key);}@SuppressWarnings({"unchecked"})- public List<Long> getLongs(Object key) {+ public List<Long> getLongs(String key) {return (List<Long>)this.fields.get(key);}@SuppressWarnings({"unchecked"})- public List<Double> getDoubles(Object key) {+ public List<Double> getDoubles(String key) {return (List<Double>)this.fields.get(key);}/*** Return all tuple fields and their values.*/- public Map<Object, Object> getFields() {+ public Map<String, Object> getFields() {return this.fields;}@@ -235,8 +225,7 @@ public class Tuple implements Cloneable, MapWriter {* @deprecated use {@link #getFields()} instead.*/@Deprecated(since = "8.6.0")- @SuppressWarnings({"rawtypes"})- public Map getMap() {+ public Map<String,Object> getMap() {return this.fields;}@@ -267,32 +256,33 @@ public class Tuple implements Cloneable, MapWriter {this.fieldNames = fieldNames;}- @SuppressWarnings({"unchecked", "rawtypes"})- public List<Map> getMaps(Object key) {- return (List<Map>) this.fields.get(key);+ @SuppressWarnings({"unchecked"})+ public List<Map<?,?>> getMaps(String key) {+ return (List<Map<?,?>>) this.fields.get(key);}- public void setMaps(Object key, @SuppressWarnings({"rawtypes"})List<Map> maps) {+ public void setMaps(String key, List<Map<?,?>> maps) {this.fields.put(key, maps);}- @SuppressWarnings({"unchecked", "rawtypes"})- public Map<String, Map> getMetrics() {- return (Map<String, Map>) this.fields.get(StreamParams.METRICS);+ @SuppressWarnings({"unchecked"})+ public Map<String, Map<?,?>> getMetrics() {+ return (Map<String, Map<?,?>>) this.fields.get(StreamParams.METRICS);}- @SuppressWarnings({"rawtypes"})- public void setMetrics(Map<String, Map> metrics) {+ public void setMetrics(Map<String, Map<?,?>> metrics) {this.fields.put(StreamParams.METRICS, metrics);}public Tuple clone() {Tuple clone = new Tuple();clone.fields.putAll(fields);+ // TODO This doesn't copy EOF/Exception https://issues.apache.org/jira/browse/SOLR-15480return clone;}public void merge(Tuple other) {+ // TODO This doesn't copy EOF/Exception https://issues.apache.org/jira/browse/SOLR-15480fields.putAll(other.getFields());}@@ -301,7 +291,7 @@ public class Tuple implements Cloneable, MapWriter {if (fieldNames == null) {fields.forEach((k, v) -> {try {- ew.put((String) k, v);+ ew.put(k, v);} catch (IOException e) {throw new RuntimeException(e);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AkimaEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AkimaEvaluator.javaindex 5837b32b043..e3c66809572 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AkimaEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AkimaEvaluator.java@@ -33,7 +33,6 @@ public class AkimaEvaluator extends RecursiveNumericEvaluator implements ManyVal}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{Object first = objects[0];@@ -43,15 +42,15 @@ public class AkimaEvaluator extends RecursiveNumericEvaluator implements ManyValif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;}} else if(objects.length == 2) {Object second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}AkimaSplineInterpolator interpolator = new AkimaSplineInterpolator();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Attributes.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Attributes.javaindex 355abd9ccda..5557cc52185 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Attributes.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Attributes.java@@ -22,6 +22,5 @@ import java.util.Map;public interface Attributes {Object getAttribute(String key);void setAttribute(String key, Object value);- @SuppressWarnings({"rawtypes"})- Map getAttributes();+ Map<?,?> getAttributes();}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ChebyshevDistanceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ChebyshevDistanceEvaluator.javaindex b332451e966..feef3c9fc9d 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ChebyshevDistanceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ChebyshevDistanceEvaluator.java@@ -33,7 +33,6 @@ public class ChebyshevDistanceEvaluator extends RecursiveNumericEvaluator implem}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -50,8 +49,8 @@ public class ChebyshevDistanceEvaluator extends RecursiveNumericEvaluator implemChebyshevDistance distance = new ChebyshevDistance();return distance.compute(- ((List)first).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray(),- ((List)second).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray()+ ((List<?>)first).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray(),+ ((List<?>)second).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray());}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.javaindex 0ca8a988587..29f731293de 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java@@ -34,7 +34,6 @@ public class ConvolutionEvaluator extends RecursiveNumericEvaluator implements T}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -51,8 +50,8 @@ public class ConvolutionEvaluator extends RecursiveNumericEvaluator implements Treturn Arrays.stream(MathArrays.convolve(- ((List)first).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray(),- ((List)second).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray()+ ((List<?>)first).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray(),+ ((List<?>)second).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray())).boxed().collect(Collectors.toList());}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.javaindex a8d0cf95c59..62235601802 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java@@ -60,7 +60,6 @@ public class CorrelationEvaluator extends RecursiveObjectEvaluator implements Ma}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object ... values) throws IOException{if(values.length == 2) {@@ -83,21 +82,21 @@ public class CorrelationEvaluator extends RecursiveObjectEvaluator implements Maif (type.equals(CorrelationType.pearsons)) {PearsonsCorrelation pearsonsCorrelation = new PearsonsCorrelation();return pearsonsCorrelation.correlation(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());} else if (type.equals(CorrelationType.kendalls)) {KendallsCorrelation kendallsCorrelation = new KendallsCorrelation();return kendallsCorrelation.correlation(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());} else if (type.equals(CorrelationType.spearmans)) {SpearmansCorrelation spearmansCorrelation = new SpearmansCorrelation();return spearmansCorrelation.correlation(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());} else {return null;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CosineSimilarityEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CosineSimilarityEvaluator.javaindex 1c26ed1e9f2..e90bb9d0e42 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CosineSimilarityEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CosineSimilarityEvaluator.java@@ -46,10 +46,8 @@ public class CosineSimilarityEvaluator extends RecursiveNumericEvaluator implemethrow new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName()));}- @SuppressWarnings({"unchecked"})- double[] d1 = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- @SuppressWarnings({"unchecked"})- double[] d2 = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ double[] d1 = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ double[] d2 = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();return cosineSimilarity(d1, d2);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.javaindex 83988db3371..803ac897882 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java@@ -32,7 +32,6 @@ public class CovarianceEvaluator extends RecursiveObjectEvaluator implements Man}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object ... values) throws IOException{if(values.length == 2) {@@ -41,8 +40,8 @@ public class CovarianceEvaluator extends RecursiveObjectEvaluator implements ManCovariance covariance = new Covariance();return covariance.covariance(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());} else if(values.length == 1) {Matrix matrix = (Matrix) values[0];diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DbscanEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DbscanEvaluator.javaindex 52ad7a662b3..ee2075529e3 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DbscanEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DbscanEvaluator.java@@ -41,7 +41,6 @@ public class DbscanEvaluator extends RecursiveObjectEvaluator implements ManyVal}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... values) throws IOException {Matrix matrix = null;@@ -75,8 +74,7 @@ public class DbscanEvaluator extends RecursiveObjectEvaluator implements ManyValdistanceMeasure = (DistanceMeasure)values[3];}- @SuppressWarnings({"rawtypes"})- DBSCANClusterer<ClusterPoint> dbscan = new DBSCANClusterer(e, minPoints, distanceMeasure);+ DBSCANClusterer<ClusterPoint> dbscan = new DBSCANClusterer<>(e, minPoints, distanceMeasure);List<ClusterPoint> points = new ArrayList<>();double[][] data = matrix.getData();List<String> ids = matrix.getRowLabels();@@ -90,8 +88,7 @@ public class DbscanEvaluator extends RecursiveObjectEvaluator implements ManyVal}}- @SuppressWarnings({"rawtypes"})- Map fields = new HashMap();+ Map<String, Object> fields = new HashMap<>();fields.put("e", e);fields.put("minPoints", minPoints);@@ -124,7 +121,7 @@ public class DbscanEvaluator extends RecursiveObjectEvaluator implements ManyValprivate List<String> columnLabels;private List<Cluster<ClusterPoint>> clusters;- public ClusterTuple(@SuppressWarnings({"rawtypes"})Map fields,+ public ClusterTuple(Map<String,Object> fields,List<Cluster<ClusterPoint>> clusters,List<String> columnLabels) {super(fields);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.javaindex 684a651dda0..d42a03ff6c0 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java@@ -38,7 +38,6 @@ public class DistanceEvaluator extends RecursiveObjectEvaluator implements ManyV}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object ... values) throws IOException{if(values.length == 1) {@@ -76,8 +75,8 @@ public class DistanceEvaluator extends RecursiveObjectEvaluator implements ManyVDistanceMeasure distanceMeasure = new EuclideanDistance();return distanceMeasure.compute(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());}} else if (values.length == 3) {@@ -102,8 +101,8 @@ public class DistanceEvaluator extends RecursiveObjectEvaluator implements ManyV}return distanceMeasure.compute(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());} else {throw new IOException("distance function operates on either two numeric arrays or a single matrix as parameters.");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DotProductEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DotProductEvaluator.javaindex 7874c328525..5f05b2a3e17 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DotProductEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DotProductEvaluator.java@@ -48,10 +48,8 @@ public class DotProductEvaluator extends RecursiveNumericEvaluator implements Twthrow new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName()));}- @SuppressWarnings({"unchecked", "rawtypes"})- RealVector v = new ArrayRealVector(((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());- @SuppressWarnings({"unchecked", "rawtypes"})- RealVector v2 = new ArrayRealVector(((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());+ RealVector v = new ArrayRealVector(((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());+ RealVector v2 = new ArrayRealVector(((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());return v.dotProduct(v2);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEAddEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEAddEvaluator.javaindex 0c7f2d5e510..a650be3c2ec 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEAddEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEAddEvaluator.java@@ -34,7 +34,6 @@ public class EBEAddEvaluator extends RecursiveObjectEvaluator implements TwoValu}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -45,8 +44,8 @@ public class EBEAddEvaluator extends RecursiveObjectEvaluator implements TwoValuif(first instanceof List && second instanceof List) {double[] result = MathArrays.ebeAdd(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());List<Number> numbers = new ArrayList<>();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEDivideEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEDivideEvaluator.javaindex bf89b49bd49..709a49ab8c8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEDivideEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEDivideEvaluator.java@@ -47,10 +47,9 @@ public class EBEDivideEvaluator extends RecursiveNumericEvaluator implements Twothrow new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName()));}- @SuppressWarnings({"unchecked"})double[] result = MathArrays.ebeDivide(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());List<Number> numbers = new ArrayList<>();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEMultiplyEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEMultiplyEvaluator.javaindex 0c1f14e0f04..75bc4f1eda7 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEMultiplyEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBEMultiplyEvaluator.java@@ -33,7 +33,6 @@ public class EBEMultiplyEvaluator extends RecursiveNumericEvaluator implements T}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -49,8 +48,8 @@ public class EBEMultiplyEvaluator extends RecursiveNumericEvaluator implements T}double[] result = MathArrays.ebeMultiply(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());List<Number> numbers = new ArrayList<>();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBESubtractEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBESubtractEvaluator.javaindex d52dd0602af..7aff9c6eccf 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBESubtractEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EBESubtractEvaluator.java@@ -34,7 +34,6 @@ public class EBESubtractEvaluator extends RecursiveObjectEvaluator implements Tw}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -44,8 +43,8 @@ public class EBESubtractEvaluator extends RecursiveObjectEvaluator implements Tw}if(first instanceof List && second instanceof List) {double[] result = MathArrays.ebeSubtract(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());List<Number> numbers = new ArrayList<>();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnclosingDiskEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnclosingDiskEvaluator.javaindex 1dbf183bf62..be8ed1c0d6c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnclosingDiskEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnclosingDiskEvaluator.java@@ -45,8 +45,7 @@ public class EnclosingDiskEvaluator extends RecursiveObjectEvaluator implements}}- @SuppressWarnings({"rawtypes"})- public static EnclosingBall getEnclosingDisk(Matrix matrix) throws IOException {+ public static EnclosingBall<Euclidean2D, Vector2D> getEnclosingDisk(Matrix matrix) throws IOException {double[][] data = matrix.getData();List<Vector2D> points = new ArrayList<>(data.length);if(data[0].length == 2) {@@ -54,10 +53,8 @@ public class EnclosingDiskEvaluator extends RecursiveObjectEvaluator implementspoints.add(new Vector2D(row[0], row[1]));}-- @SuppressWarnings({"unchecked"})- WelzlEncloser<Euclidean2D, Vector2D> welzlEncloser = new WelzlEncloser(.001, new DiskGenerator());- EnclosingBall enclosingBall = welzlEncloser.enclose(points);+ WelzlEncloser<Euclidean2D, Vector2D> welzlEncloser = new WelzlEncloser<>(.001, new DiskGenerator());+ EnclosingBall<Euclidean2D, Vector2D> enclosingBall = welzlEncloser.enclose(points);return enclosingBall;} else {throw new IOException("The enclosingDisk function operates on a matrix of 2D vectors");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnumeratedDistributionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnumeratedDistributionEvaluator.javaindex ed6fe9f5351..e2bc8f40fea 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnumeratedDistributionEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EnumeratedDistributionEvaluator.java@@ -41,18 +41,15 @@ public class EnumeratedDistributionEvaluator extends RecursiveNumericEvaluator iif(values.length == 1) {@SuppressWarnings({"unchecked"})List<Number> first = (List<Number>)values[0];- @SuppressWarnings({"unchecked", "rawtypes"})- int[] samples = ((List) first).stream().mapToInt(value -> ((Number) value).intValue()).toArray();+ int[] samples = ((List<?>) first).stream().mapToInt(value -> ((Number) value).intValue()).toArray();return new EnumeratedIntegerDistribution(samples);} else {@SuppressWarnings({"unchecked"})List<Number> first = (List<Number>)values[0];@SuppressWarnings({"unchecked"})List<Number> second = (List<Number>)values[1];- @SuppressWarnings({"unchecked", "rawtypes"})- int[] singletons = ((List) first).stream().mapToInt(value -> ((Number) value).intValue()).toArray();- @SuppressWarnings({"unchecked", "rawtypes"})- double[] probs = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ int[] singletons = ((List<?>) first).stream().mapToInt(value -> ((Number) value).intValue()).toArray();+ double[] probs = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();return new EnumeratedIntegerDistribution(singletons, probs);}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EuclideanDistanceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EuclideanDistanceEvaluator.javaindex 1f692dc9021..9fa572e6dfb 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EuclideanDistanceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/EuclideanDistanceEvaluator.java@@ -33,7 +33,6 @@ public class EuclideanDistanceEvaluator extends RecursiveNumericEvaluator implem}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -50,8 +49,8 @@ public class EuclideanDistanceEvaluator extends RecursiveNumericEvaluator implemEuclideanDistance distance = new EuclideanDistance();return distance.compute(- ((List)first).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray(),- ((List)second).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray()+ ((List<?>)first).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray(),+ ((List<?>)second).stream().mapToDouble(value -> ((BigDecimal)value).doubleValue()).toArray());}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FeatureSelectEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FeatureSelectEvaluator.javaindex 10da5c771b1..bee3a0071aa 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FeatureSelectEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FeatureSelectEvaluator.java@@ -81,8 +81,7 @@ public class FeatureSelectEvaluator extends RecursiveObjectEvaluator implements}private void loadFeatures(Object o, Set<String> features) {- @SuppressWarnings({"rawtypes"})- List list = (List)o;+ List<?> list = (List<?>)o;for(Object v : list) {if(v instanceof List) {loadFeatures(v, features);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.javaindex ef0b4475250..6b202d0b7fa 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java@@ -52,11 +52,9 @@ public class FindDelayEvaluator extends RecursiveNumericEvaluator implements Two}// Get first and second lists as arrays, where second is in reverse order- @SuppressWarnings({"unchecked", "rawtypes"})- double[] firstArray = ((List)first).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray();- @SuppressWarnings({"unchecked", "rawtypes"})+ double[] firstArray = ((List<?>)first).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray();double[] secondArray = StreamSupport.stream(Spliterators.spliteratorUnknownSize(- ((LinkedList)((List)second).stream().collect(Collectors.toCollection(LinkedList::new))).descendingIterator(),+ ((LinkedList<?>)((List<?>)second).stream().collect(Collectors.toCollection(LinkedList::new))).descendingIterator(),Spliterator.ORDERED), false).mapToDouble(value -> ((Number)value).doubleValue()).toArray();double[] convolution = MathArrays.convolve(firstArray, secondArray);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FrequencyTableEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FrequencyTableEvaluator.javaindex 200017870d4..07f64dba896 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FrequencyTableEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FrequencyTableEvaluator.java@@ -65,8 +65,7 @@ public class FrequencyTableEvaluator extends RecursiveNumericEvaluator implementList<Tuple> histogramBins = new ArrayList<>();- @SuppressWarnings({"rawtypes"})- Iterator iterator = frequency.valuesIterator();+ Iterator<Comparable<?>> iterator = frequency.valuesIterator();while(iterator.hasNext()){Long value = (Long)iterator.next();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FuzzyKmeansEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FuzzyKmeansEvaluator.javaindex 355f32f9eaf..7526e18fb7a 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FuzzyKmeansEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FuzzyKmeansEvaluator.java@@ -56,14 +56,10 @@ public class FuzzyKmeansEvaluator extends RecursiveObjectEvaluator implements Tw}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object value1, Object value2) throws IOException {--Matrix matrix = null;int k = 0;-if(value1 instanceof Matrix) {matrix = (Matrix)value1;} else {@@ -76,8 +72,7 @@ public class FuzzyKmeansEvaluator extends RecursiveObjectEvaluator implements Twthrow new IOException("The second parameter for fuzzyKmeans should be k.");}- @SuppressWarnings({"rawtypes"})- FuzzyKMeansClusterer<KmeansEvaluator.ClusterPoint> kmeans = new FuzzyKMeansClusterer(k,+ FuzzyKMeansClusterer<KmeansEvaluator.ClusterPoint> kmeans = new FuzzyKMeansClusterer<>(k,fuzziness,maxIterations,new EuclideanDistance());@@ -91,8 +86,7 @@ public class FuzzyKmeansEvaluator extends RecursiveObjectEvaluator implements Twpoints.add(new KmeansEvaluator.ClusterPoint(ids.get(i), vec));}- @SuppressWarnings({"rawtypes"})- Map fields = new HashMap();+ Map<String, Object> fields = new HashMap<>();fields.put("k", k);fields.put("fuzziness", fuzziness);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GaussFitEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GaussFitEvaluator.javaindex 8b5161bd06d..40d314434be 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GaussFitEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GaussFitEvaluator.java@@ -37,7 +37,6 @@ public class GaussFitEvaluator extends RecursiveNumericEvaluator implements Many}@Override- @SuppressWarnings({"unchecked", "rawtypes"})public Object doWork(Object... objects) throws IOException{if(objects.length >= 3) {@@ -52,7 +51,7 @@ public class GaussFitEvaluator extends RecursiveNumericEvaluator implements Manyif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -61,8 +60,8 @@ public class GaussFitEvaluator extends RecursiveNumericEvaluator implements Many} else if(objects.length == 2) {// x and y passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}@@ -81,7 +80,7 @@ public class GaussFitEvaluator extends RecursiveNumericEvaluator implements Manydouble[] coef = curveFitter.fit(pointList);Gaussian gaussian = new Gaussian(coef[0], coef[1], coef[2]);- List list = new ArrayList();+ List<Double> list = new ArrayList<>();for(double xvalue : x) {double yvalue= gaussian.value(xvalue);list.add(yvalue);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCacheEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCacheEvaluator.javaindex 16b8050b920..786d4e25099 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCacheEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCacheEvaluator.java@@ -37,21 +37,15 @@ public class GetCacheEvaluator extends RecursiveObjectEvaluator implements ManyV@Overridepublic Object doWork(Object... values) throws IOException {- @SuppressWarnings({"rawtypes"})- ConcurrentMap objectCache = this.streamContext.getObjectCache();if(values.length == 2) {String space = (String)values[0];String key = (String)values[1];space = space.replace("\"", "");key = key.replace("\"", "");- @SuppressWarnings({"rawtypes"})- ConcurrentMap spaceCache = (ConcurrentMap)objectCache.get(space);- if(spaceCache != null) {- return spaceCache.get(key);- }-- return null;+ ConcurrentMap<String, ConcurrentMap<String, Object>> objectCache = this.streamContext.getObjectCache();+ ConcurrentMap<String, Object> spaceCache = objectCache.get(space);+ return (spaceCache != null) ? spaceCache.get(key) : null;} else {throw new IOException("The getCache function requires two parameters: workspace and key");}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCenterEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCenterEvaluator.javaindex 2fc1ae8cb3d..9f9cc1ee4d2 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCenterEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetCenterEvaluator.java@@ -41,8 +41,7 @@ public class GetCenterEvaluator extends RecursiveObjectEvaluator implements OneVif(!(value instanceof EnclosingBall)){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for value, expecting an EnclosingBall",toExpression(constructingFactory), value.getClass().getSimpleName()));} else {- @SuppressWarnings({"rawtypes"})- EnclosingBall enclosingBall = (EnclosingBall)value;+ EnclosingBall<?,?> enclosingBall = (EnclosingBall<?,?>)value;Vector2D vec = (Vector2D)enclosingBall.getCenter();List<Number> center = new ArrayList<>();center.add(vec.getX());diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetClusterEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetClusterEvaluator.javaindex a840967620b..a3d6b421e76 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetClusterEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetClusterEvaluator.java@@ -44,15 +44,13 @@ public class GetClusterEvaluator extends RecursiveObjectEvaluator implements TwoList<CentroidCluster<KmeansEvaluator.ClusterPoint>> clusters = clusterTuple.getClusters();Number index = (Number)value2;- @SuppressWarnings({"rawtypes"})- CentroidCluster cluster = clusters.get(index.intValue());- @SuppressWarnings({"rawtypes"})- List points = cluster.getPoints();+ CentroidCluster<KmeansEvaluator.ClusterPoint> cluster = clusters.get(index.intValue());+ List<KmeansEvaluator.ClusterPoint> points = cluster.getPoints();List<String> rowLabels = new ArrayList<>();double[][] data = new double[points.size()][];for(int i=0; i<points.size(); i++) {- KmeansEvaluator.ClusterPoint p = (KmeansEvaluator.ClusterPoint)points.get(i);+ KmeansEvaluator.ClusterPoint p = points.get(i);data[i] = p.getPoint();rowLabels.add(p.getId());}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetRadiusEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetRadiusEvaluator.javaindex b3680929ff1..082bf9f2f5a 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetRadiusEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetRadiusEvaluator.java@@ -37,8 +37,7 @@ public class GetRadiusEvaluator extends RecursiveObjectEvaluator implements OneVif(!(value instanceof EnclosingBall)){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for value, expecting an EnclosingBall",toExpression(constructingFactory), value.getClass().getSimpleName()));} else {- @SuppressWarnings({"rawtypes"})- EnclosingBall enclosingBall = (EnclosingBall)value;+ EnclosingBall<?,?> enclosingBall = (EnclosingBall<?,?>)value;return enclosingBall.getRadius();}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetSupportPointsEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetSupportPointsEvaluator.javaindex 3b846c947d9..4fef49e41cd 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetSupportPointsEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/GetSupportPointsEvaluator.java@@ -39,13 +39,11 @@ public class GetSupportPointsEvaluator extends RecursiveObjectEvaluator implemenif(!(value instanceof EnclosingBall)){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for value, expecting an EnclosingBall",toExpression(constructingFactory), value.getClass().getSimpleName()));} else {- @SuppressWarnings({"rawtypes"})- EnclosingBall enclosingBall = (EnclosingBall)value;- @SuppressWarnings({"rawtypes"})- Point[] points = enclosingBall.getSupport();+ EnclosingBall<?,?> enclosingBall = (EnclosingBall<?,?>)value;+ Point<?>[] points = enclosingBall.getSupport();double[][] data = new double[points.length][2];int i=0;- for(@SuppressWarnings({"rawtypes"})Point point : points) {+ for(Point<?> point : points) {Vector2D eu = (Vector2D)point;data[i][0] = eu.getX();data[i][1] = eu.getY();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HarmonicFitEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HarmonicFitEvaluator.javaindex f1f36468ac2..0937c39db09 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HarmonicFitEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HarmonicFitEvaluator.java@@ -34,7 +34,6 @@ public class HarmonicFitEvaluator extends RecursiveNumericEvaluator implements M}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{if(objects.length > 3) {@@ -49,7 +48,7 @@ public class HarmonicFitEvaluator extends RecursiveNumericEvaluator implements Mif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -58,8 +57,8 @@ public class HarmonicFitEvaluator extends RecursiveNumericEvaluator implements M} else if(objects.length == 2) {// x and y passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}@@ -77,14 +76,12 @@ public class HarmonicFitEvaluator extends RecursiveNumericEvaluator implements Mdouble[] coef = curveFitter.fit(points.toList());HarmonicOscillator pf = new HarmonicOscillator(coef[0], coef[1], coef[2]);- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ List<Number> list = new ArrayList<>();for(double xvalue : x) {double yvalue= pf.value(xvalue);list.add(yvalue);}- @SuppressWarnings({"unchecked"})VectorFunction vectorFunction = new VectorFunction(pf, list);vectorFunction.addToContext("amplitude", coef[0]);vectorFunction.addToContext("angularFrequency", coef[1]);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IndexOfEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IndexOfEvaluator.javaindex 81714a23d74..1eacfbdf70c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IndexOfEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IndexOfEvaluator.java@@ -36,8 +36,7 @@ public class IndexOfEvaluator extends RecursiveObjectEvaluator implements TwoValif(!(value1 instanceof List)){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for value, expecting an array",toExpression(constructingFactory), value1.getClass().getSimpleName()));} else {- @SuppressWarnings({"rawtypes"})- List list = (List)value1;+ List<?> list = (List<?>)value1;String find = value2.toString().replace("\"","");for(int i=0; i<list.size(); i++) {Object o = list.get(i);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KmeansEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KmeansEvaluator.javaindex 577eb2dfa4b..db9bec0e244 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KmeansEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KmeansEvaluator.java@@ -52,7 +52,6 @@ public class KmeansEvaluator extends RecursiveObjectEvaluator implements TwoValu}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object value1, Object value2) throws IOException {Matrix matrix = null;@@ -71,8 +70,7 @@ public class KmeansEvaluator extends RecursiveObjectEvaluator implements TwoValu}- @SuppressWarnings({"rawtypes"})- KMeansPlusPlusClusterer<ClusterPoint> kmeans = new KMeansPlusPlusClusterer(k, maxIterations);+ KMeansPlusPlusClusterer<ClusterPoint> kmeans = new KMeansPlusPlusClusterer<>(k, maxIterations);List<ClusterPoint> points = new ArrayList<>();double[][] data = matrix.getData();@@ -87,8 +85,7 @@ public class KmeansEvaluator extends RecursiveObjectEvaluator implements TwoValu}}- @SuppressWarnings({"rawtypes"})- Map fields = new HashMap();+ Map<String, Object> fields = new HashMap<>();fields.put("k", k);fields.put("distance", "euclidean");@@ -122,7 +119,7 @@ public class KmeansEvaluator extends RecursiveObjectEvaluator implements TwoValuprivate List<CentroidCluster<ClusterPoint>> clusters;private Matrix membershipMatrix;- public ClusterTuple(@SuppressWarnings({"rawtypes"})Map fields,+ public ClusterTuple(Map<String, ?> fields,List<CentroidCluster<ClusterPoint>> clusters,List<String> columnLabels) {super(fields);@@ -130,7 +127,7 @@ public class KmeansEvaluator extends RecursiveObjectEvaluator implements TwoValuthis.columnLabels = columnLabels;}- public ClusterTuple(@SuppressWarnings({"rawtypes"})Map fields,+ public ClusterTuple(Map<String, ?> fields,List<CentroidCluster<ClusterPoint>> clusters,List<String> columnLabels,Matrix membershipMatrix) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KnnRegressionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KnnRegressionEvaluator.javaindex 80cd64030ed..91f4f9475bf 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KnnRegressionEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/KnnRegressionEvaluator.java@@ -54,7 +54,6 @@ public class KnnRegressionEvaluator extends RecursiveObjectEvaluator implements}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object ... values) throws IOException {if(values.length < 3) {@@ -71,6 +70,7 @@ public class KnnRegressionEvaluator extends RecursiveObjectEvaluator implementsobservations = (Matrix)values[0];} else if(values[0] instanceof List) {bivariate = true;+ @SuppressWarnings({"unchecked"})List<Number> vec = (List<Number>)values[0];double[][] data = new double[vec.size()][1];for(int i=0; i<vec.size(); i++) {@@ -82,7 +82,9 @@ public class KnnRegressionEvaluator extends RecursiveObjectEvaluator implements}if(values[1] instanceof List) {- outcomes = (List) values[1];+ @SuppressWarnings("unchecked")+ List<Number> temp = (List<Number>) values[1];+ outcomes = temp;} else {throw new IOException("The second parameter for knnRegress should be outcome array. ");}@@ -106,8 +108,7 @@ public class KnnRegressionEvaluator extends RecursiveObjectEvaluator implementsoutcomeData[i] = outcomes.get(i).doubleValue();}- @SuppressWarnings({"rawtypes"})- Map map = new HashMap();+ Map<String, Object> map = new HashMap<>();map.put("k", k);map.put("observations", observations.getRowCount());map.put("features", observations.getColumnCount());@@ -134,7 +135,7 @@ public class KnnRegressionEvaluator extends RecursiveObjectEvaluator implementsdouble[] outcomes,int k,DistanceMeasure distanceMeasure,- Map<?,?> map,+ Map<String,Object> map,boolean scale,boolean robust,boolean bivariate) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LatLonVectorsEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LatLonVectorsEvaluator.javaindex 39212b3df88..16d24d80359 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LatLonVectorsEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LatLonVectorsEvaluator.java@@ -67,8 +67,7 @@ public class LatLonVectorsEvaluator extends RecursiveObjectEvaluator implementsif(!(objects[0] instanceof List)) {throw new IOException("The latlonVectors function expects a list of Tuples as a parameter.");} else {- @SuppressWarnings({"rawtypes"})- List list = (List)objects[0];+ List<?> list = (List<?>)objects[0];if(list.size() > 0) {Object o = list.get(0);if(!(o instanceof Tuple)) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LerpEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LerpEvaluator.javaindex e43992f7aa2..1e78f01a359 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LerpEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LerpEvaluator.java@@ -33,7 +33,6 @@ public class LerpEvaluator extends RecursiveNumericEvaluator implements ManyValu}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{Object first = objects[0];@@ -43,15 +42,15 @@ public class LerpEvaluator extends RecursiveNumericEvaluator implements ManyValuif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;}} else if(objects.length == 2) {Object second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}LinearInterpolator interpolator = new LinearInterpolator();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ListCacheEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ListCacheEvaluator.javaindex 05048379d46..0609d32358c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ListCacheEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ListCacheEvaluator.java@@ -18,13 +18,12 @@ package org.apache.solr.client.solrj.io.eval;import java.io.IOException;-import java.util.Enumeration;+import java.util.Collections;import java.util.Locale;-import java.util.concurrent.ConcurrentMap;-import java.util.concurrent.ConcurrentHashMap;+import java.util.Map;-import java.util.List;import java.util.ArrayList;+import java.util.concurrent.ConcurrentMap;import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;@@ -41,38 +40,19 @@ public class ListCacheEvaluator extends RecursiveObjectEvaluator implements Many}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... values) throws IOException {- @SuppressWarnings({"rawtypes"})- ConcurrentMap objectCache = this.streamContext.getObjectCache();- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ Map<String, ConcurrentMap<String, Object>> objectCache = this.streamContext.getObjectCache();if(values.length == 0) {- @SuppressWarnings({"rawtypes"})- ConcurrentHashMap m = (ConcurrentHashMap)objectCache;- @SuppressWarnings({"rawtypes"})- Enumeration en = m.keys();- while(en.hasMoreElements()) {- list.add(en.nextElement());- }- return list;+ return new ArrayList<>(objectCache.keySet());} else if(values.length == 1) {String space = (String)values[0];space = space.replace("\"", "");- @SuppressWarnings({"rawtypes"})- ConcurrentMap spaceCache = (ConcurrentMap)objectCache.get(space);+ Map<String,Object> spaceCache = objectCache.get(space);if(spaceCache != null) {- @SuppressWarnings({"rawtypes"})- ConcurrentHashMap spaceMap = (ConcurrentHashMap)objectCache.get(space);- @SuppressWarnings({"rawtypes"})- Enumeration en = spaceMap.keys();- while(en.hasMoreElements()) {- list.add(en.nextElement());- }- return list;+ return new ArrayList<>(spaceCache.keySet());} else {- return list;+ return Collections.emptyList();}} else {throw new IOException("The listCache function requires two parameters: workspace and key");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LoessEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LoessEvaluator.javaindex 43695889013..3176a1e4e7f 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LoessEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LoessEvaluator.java@@ -52,7 +52,6 @@ public class LoessEvaluator extends RecursiveNumericEvaluator implements ManyVal}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{Object first = objects[0];@@ -62,15 +61,15 @@ public class LoessEvaluator extends RecursiveNumericEvaluator implements ManyValif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;}} else if(objects.length == 2) {Object second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}LoessInterpolator interpolator = new LoessInterpolator(bandwidth, robustIterations);@@ -94,7 +93,7 @@ public class LoessEvaluator extends RecursiveNumericEvaluator implements ManyValpublic static class LoessRegressionTuple extends Tuple {private PolynomialSplineFunction spline;- public LoessRegressionTuple(PolynomialSplineFunction spline, Map<?,?> map) {+ public LoessRegressionTuple(PolynomialSplineFunction spline, Map<String,Object> map) {super(map);this.spline = spline;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Matrix.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Matrix.javaindex 87940931eff..8938c1f9020 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Matrix.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/Matrix.java@@ -23,8 +23,7 @@ import java.util.ArrayList;import java.util.Iterator;-@SuppressWarnings({"rawtypes"})-public class Matrix implements Iterable, Attributes {+public class Matrix implements Iterable<List<Double>>, Attributes {private double[][] data;private List<String> columnLabels;@@ -36,8 +35,7 @@ public class Matrix implements Iterable, Attributes {this.data = data;}- @SuppressWarnings({"rawtypes"})- public Map getAttributes() {+ public Map<?,?> getAttributes() {return this.attributes;}@@ -77,13 +75,11 @@ public class Matrix implements Iterable, Attributes {return data[0].length;}- @SuppressWarnings({"rawtypes"})- public Iterator iterator() {+ public Iterator<List<Double>> iterator() {return new MatrixIterator(data);}- @SuppressWarnings({"rawtypes"})- private static class MatrixIterator implements Iterator {+ private static class MatrixIterator implements Iterator<List<Double>> {private double[][] d;private int index;@@ -92,10 +88,9 @@ public class Matrix implements Iterable, Attributes {d = data;}- @SuppressWarnings({"unchecked"})- public Object next() {+ public List<Double> next() {double[] row = d[index++];- List list = new ArrayList();+ List<Double> list = new ArrayList<>();for(double value : row) {list.add(value);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MeanDifferenceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MeanDifferenceEvaluator.javaindex 9252eb6008e..75a4a68eb24 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MeanDifferenceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MeanDifferenceEvaluator.java@@ -32,7 +32,6 @@ public class MeanDifferenceEvaluator extends RecursiveNumericEvaluator implement}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -48,8 +47,8 @@ public class MeanDifferenceEvaluator extends RecursiveNumericEvaluator implement}return StatUtils.meanDifference(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MinMaxScaleEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MinMaxScaleEvaluator.javaindex 1bb0855f83d..ab49f7facb6 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MinMaxScaleEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MinMaxScaleEvaluator.java@@ -58,7 +58,7 @@ public class MinMaxScaleEvaluator extends RecursiveObjectEvaluator implements Ma} else if(values[0] instanceof List) {@SuppressWarnings({"unchecked"})- List<Number> vec = (List)values[0];+ List<Number> vec = (List<Number>)values[0];double[] data = new double[vec.size()];for(int i=0; i<vec.size(); i++) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MonteCarloEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MonteCarloEvaluator.javaindex 24df98b1ccb..a0c27fa62d2 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MonteCarloEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MonteCarloEvaluator.java@@ -35,10 +35,8 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;public class MonteCarloEvaluator extends RecursiveEvaluator {protected static final long serialVersionUID = 1L;- @SuppressWarnings({"rawtypes"})- private Map variables = new LinkedHashMap();+ private Map<String, Object> variables = new LinkedHashMap<>();- @SuppressWarnings({"unchecked"})public MonteCarloEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{super(expression, factory);@@ -46,10 +44,10 @@ public class MonteCarloEvaluator extends RecursiveEvaluator {//Get all the named paramsSet<String> echo = null;boolean echoAll = false;- for(StreamExpressionParameter np : namedParams) {- String name = ((StreamExpressionNamedParameter)np).getName();+ for(StreamExpressionNamedParameter np : namedParams) {+ String name = np.getName();- StreamExpressionParameter param = ((StreamExpressionNamedParameter)np).getParameter();+ StreamExpressionParameter param = np.getParameter();if(factory.isEvaluator((StreamExpression)param)) {StreamEvaluator evaluator = factory.constructEvaluator((StreamExpression) param);variables.put(name, evaluator);@@ -105,7 +103,6 @@ public class MonteCarloEvaluator extends RecursiveEvaluator {private void populateVariables(Tuple contextTuple) throws IOException {- @SuppressWarnings({"unchecked"})Set<Map.Entry<String, Object>> entries = variables.entrySet();for(Map.Entry<String, Object> entry : entries) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MultiKmeansEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MultiKmeansEvaluator.javaindex c41ce5bca62..c1d7b7f1c02 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MultiKmeansEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MultiKmeansEvaluator.java@@ -49,7 +49,6 @@ public class MultiKmeansEvaluator extends RecursiveObjectEvaluator implements Ma}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... values) throws IOException {if(values.length != 3) {@@ -82,10 +81,8 @@ public class MultiKmeansEvaluator extends RecursiveObjectEvaluator implements Mathrow new IOException("The third parameter for multiKmeans should be trials.");}- @SuppressWarnings({"rawtypes"})- KMeansPlusPlusClusterer<KmeansEvaluator.ClusterPoint> kmeans = new KMeansPlusPlusClusterer(k, maxIterations);- @SuppressWarnings({"rawtypes"})- MultiKMeansPlusPlusClusterer multiKmeans = new MultiKMeansPlusPlusClusterer(kmeans, trials);+ KMeansPlusPlusClusterer<KmeansEvaluator.ClusterPoint> kmeans = new KMeansPlusPlusClusterer<>(k, maxIterations);+ MultiKMeansPlusPlusClusterer<KmeansEvaluator.ClusterPoint> multiKmeans = new MultiKMeansPlusPlusClusterer<>(kmeans, trials);List<KmeansEvaluator.ClusterPoint> points = new ArrayList<>();double[][] data = matrix.getData();@@ -97,8 +94,7 @@ public class MultiKmeansEvaluator extends RecursiveObjectEvaluator implements Mapoints.add(new KmeansEvaluator.ClusterPoint(ids.get(i), vec));}- @SuppressWarnings({"rawtypes"})- Map fields = new HashMap();+ Map<String, Object> fields = new HashMap<>();fields.put("k", k);fields.put("trials", trials);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OLSRegressionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OLSRegressionEvaluator.javaindex f35299af95d..4e2b9bd9f60 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OLSRegressionEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OLSRegressionEvaluator.java@@ -63,8 +63,7 @@ public class OLSRegressionEvaluator extends RecursiveObjectEvaluator implementsOLSMultipleLinearRegression multipleLinearRegression = (OLSMultipleLinearRegression)regress(observationData, outcomeData);- @SuppressWarnings({"rawtypes"})- Map map = new HashMap();+ Map<String, Object> map = new HashMap<>();map.put("regressandVariance", multipleLinearRegression.estimateRegressandVariance());map.put("regressionParameters", list(multipleLinearRegression.estimateRegressionParameters()));@@ -82,10 +81,8 @@ public class OLSRegressionEvaluator extends RecursiveObjectEvaluator implementsreturn new MultipleRegressionTuple(multipleLinearRegression, map);}- @SuppressWarnings({"unchecked"})private List<Number> list(double[] values) {- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ List<Number> list = new ArrayList<>();for(double d : values) {list.add(d);}@@ -103,7 +100,7 @@ public class OLSRegressionEvaluator extends RecursiveObjectEvaluator implementsprivate MultipleLinearRegression multipleLinearRegression;- public MultipleRegressionTuple(MultipleLinearRegression multipleLinearRegression, Map<?,?> map) {+ public MultipleRegressionTuple(MultipleLinearRegression multipleLinearRegression, Map<String,Object> map) {super(map);this.multipleLinearRegression = multipleLinearRegression;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OscillateEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OscillateEvaluator.javaindex 7e452ecbde9..61cd196cd00 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OscillateEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/OscillateEvaluator.java@@ -32,7 +32,6 @@ public class OscillateEvaluator extends RecursiveNumericEvaluator implements Man}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{if(objects.length != 3) {@@ -47,8 +46,7 @@ public class OscillateEvaluator extends RecursiveNumericEvaluator implements ManHarmonicOscillator pf = new HarmonicOscillator(amp, om, phase);double[] x = new double[128];- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ List<Number> list = new ArrayList<>();for(int i=0; i<128; i++) {double yvalue= pf.value(i);list.add(yvalue);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PairSortEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PairSortEvaluator.javaindex 5e2b75d77dc..dec526507fd 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PairSortEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PairSortEvaluator.java@@ -34,7 +34,6 @@ public class PairSortEvaluator extends RecursiveNumericEvaluator implements TwoV}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -49,7 +48,9 @@ public class PairSortEvaluator extends RecursiveNumericEvaluator implements TwoVthrow new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName()));}+ @SuppressWarnings({"unchecked"})List<Number> l1 = (List<Number>)first;+ @SuppressWarnings({"unchecked"})List<Number> l2 = (List<Number>)second;if(l2.size() != l1.size()){diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitDerivativeEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitDerivativeEvaluator.javaindex ec02316c7bd..cb60ab9b480 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitDerivativeEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitDerivativeEvaluator.java@@ -36,7 +36,6 @@ public class PolyFitDerivativeEvaluator extends RecursiveNumericEvaluator implem}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{if(objects.length > 3) {@@ -52,7 +51,7 @@ public class PolyFitDerivativeEvaluator extends RecursiveNumericEvaluator implemif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -62,18 +61,18 @@ public class PolyFitDerivativeEvaluator extends RecursiveNumericEvaluator implem// x, y and degree passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();degree = ((Number)objects[2]).intValue();} else if(objects.length == 2) {if(objects[1] instanceof List) {// x and y passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();} else {// y and degree passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -93,8 +92,7 @@ public class PolyFitDerivativeEvaluator extends RecursiveNumericEvaluator implemPolynomialFunction pf = new PolynomialFunction(coef);UnivariateFunction univariateFunction = pf.derivative();- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ List<Double> list = new ArrayList<>();for(double xvalue : x) {double yvalue= univariateFunction.value(xvalue);list.add(yvalue);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitEvaluator.javaindex 2346a7b0265..d6b16ace12b 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PolyFitEvaluator.java@@ -35,7 +35,6 @@ public class PolyFitEvaluator extends RecursiveNumericEvaluator implements ManyV}@Override- @SuppressWarnings({"unchecked", "rawtypes"})public Object doWork(Object... objects) throws IOException{if(objects.length > 3) {@@ -51,7 +50,7 @@ public class PolyFitEvaluator extends RecursiveNumericEvaluator implements ManyVif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -61,18 +60,18 @@ public class PolyFitEvaluator extends RecursiveNumericEvaluator implements ManyV// x, y and degree passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();degree = ((Number)objects[2]).intValue();} else if(objects.length == 2) {if(objects[1] instanceof List) {// x and y passedObject second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();} else {// y and degree passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;@@ -91,7 +90,7 @@ public class PolyFitEvaluator extends RecursiveNumericEvaluator implements ManyVdouble[] coef = curveFitter.fit(points.toList());PolynomialFunction pf = new PolynomialFunction(coef);- List list = new ArrayList();+ List<Number> list = new ArrayList<>();for(double xvalue : x) {double yvalue= pf.value(xvalue);list.add(yvalue);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PutCacheEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PutCacheEvaluator.javaindex 0fb9379800a..2df5b1598d5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PutCacheEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/PutCacheEvaluator.java@@ -37,21 +37,16 @@ public class PutCacheEvaluator extends RecursiveObjectEvaluator implements ManyV}@Override- @SuppressWarnings({"unchecked", "rawtypes"})public Object doWork(Object... values) throws IOException {- ConcurrentMap objectCache = this.streamContext.getObjectCache();if(values.length == 3) {String space = (String)values[0];String key = (String)values[1];space = space.replace("\"", "");key = key.replace("\"", "");Object value = values[2];- ConcurrentMap spaceCache = (ConcurrentMap)objectCache.get(space);- if(spaceCache == null) {- spaceCache = new ConcurrentHashMap();- objectCache.put(space, spaceCache);- }+ ConcurrentMap<String, ConcurrentMap<String, Object>> objectCache = this.streamContext.getObjectCache();+ ConcurrentMap<String, Object> spaceCache = objectCache.computeIfAbsent(space, k -> new ConcurrentHashMap<>());spaceCache.put(key, value);return value;} else {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RecursiveEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RecursiveEvaluator.javaindex 04f987ae0a0..e28b38812de 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RecursiveEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RecursiveEvaluator.java@@ -144,9 +144,9 @@ public abstract class RecursiveEvaluator implements StreamEvaluator, ValueWorkerTuple tuple = (Tuple)value;Tuple newTuple = new Tuple();- for(Object o : tuple.getFields().keySet()) {- Object v = tuple.get(o);- newTuple.put(o, normalizeOutputType(v));+ for(String s : tuple.getFields().keySet()) {+ Object v = tuple.get(s);+ newTuple.put(s, normalizeOutputType(v));}return newTuple;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RegressionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RegressionEvaluator.javaindex a06a2c7a8fe..fa1e2f4d0ad 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RegressionEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RegressionEvaluator.java@@ -82,7 +82,7 @@ public class RegressionEvaluator extends RecursiveNumericEvaluator implements Twpublic static class RegressionTuple extends Tuple {private SimpleRegression simpleRegression;- public RegressionTuple(SimpleRegression simpleRegression, Map<?,?> map) {+ public RegressionTuple(SimpleRegression simpleRegression, Map<String,Object> map) {super(map);this.simpleRegression = simpleRegression;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RemoveCacheEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RemoveCacheEvaluator.javaindex c3bd47b4c8c..be793aa87b0 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RemoveCacheEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RemoveCacheEvaluator.java@@ -37,16 +37,14 @@ public class RemoveCacheEvaluator extends RecursiveObjectEvaluator implements Ma@Overridepublic Object doWork(Object... values) throws IOException {- @SuppressWarnings({"rawtypes"})- ConcurrentMap objectCache = this.streamContext.getObjectCache();if(values.length == 2) {String space = (String)values[0];String key = (String)values[1];space = space.replace("\"", "");key = key.replace("\"", "");- @SuppressWarnings({"rawtypes"})- ConcurrentMap spaceCache = (ConcurrentMap)objectCache.get(space);+ ConcurrentMap<String, ConcurrentMap<String, Object>> objectCache = this.streamContext.getObjectCache();+ ConcurrentMap<String, Object> spaceCache = objectCache.get(space);if(spaceCache != null) {return spaceCache.remove(key);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetColumnLabelsEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetColumnLabelsEvaluator.javaindex d4610c0ceab..f0524e4df53 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetColumnLabelsEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetColumnLabelsEvaluator.java@@ -41,8 +41,7 @@ public class SetColumnLabelsEvaluator extends RecursiveObjectEvaluator implement} else {Matrix matrix = (Matrix)value1;- @SuppressWarnings({"rawtypes"})- List colLabels = (List)value2;+ List<?> colLabels = (List<?>)value2;//Convert numeric labels to strings.List<String> strLabels = new ArrayList<>(colLabels.size());for(Object o : colLabels) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetRowLabelsEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetRowLabelsEvaluator.javaindex cc6782f3f00..cded61a1f80 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetRowLabelsEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SetRowLabelsEvaluator.java@@ -40,8 +40,7 @@ public class SetRowLabelsEvaluator extends RecursiveObjectEvaluator implements Tthrow new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for value, expecting an array of labels.",toExpression(constructingFactory), value2.getClass().getSimpleName()));} else {Matrix matrix = (Matrix)value1;- @SuppressWarnings({"rawtypes"})- List rowlabels = (List)value2;+ List<?> rowlabels = (List<?>)value2;//Convert numeric labels to strings.diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplineEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplineEvaluator.javaindex eb4261668fc..89cdcc1e7b4 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplineEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplineEvaluator.java@@ -33,7 +33,6 @@ public class SplineEvaluator extends RecursiveNumericEvaluator implements ManyVa}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object... objects) throws IOException{Object first = objects[0];@@ -43,15 +42,15 @@ public class SplineEvaluator extends RecursiveNumericEvaluator implements ManyVaif(objects.length == 1) {//Only the y values passed- y = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();x = new double[y.length];for(int i=0; i<y.length; i++) {x[i] = i;}} else if(objects.length == 2) {Object second = objects[1];- x = ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();- y = ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ x = ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();+ y = ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray();}SplineInterpolator interpolator = new SplineInterpolator();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SumDifferenceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SumDifferenceEvaluator.javaindex 6c25d78c75c..15edb645b2a 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SumDifferenceEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SumDifferenceEvaluator.java@@ -32,7 +32,6 @@ public class SumDifferenceEvaluator extends RecursiveNumericEvaluator implements}@Override- @SuppressWarnings({"unchecked"})public Object doWork(Object first, Object second) throws IOException{if(null == first){throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory)));@@ -48,8 +47,8 @@ public class SumDifferenceEvaluator extends RecursiveNumericEvaluator implements}return StatUtils.sumDifference(- ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),- ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray()+ ((List<?>) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(),+ ((List<?>) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray());}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TermVectorsEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TermVectorsEvaluator.javaindex 6973a8dead9..538b3c648c6 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TermVectorsEvaluator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TermVectorsEvaluator.java@@ -74,8 +74,7 @@ public class TermVectorsEvaluator extends RecursiveObjectEvaluator implements Maif(!(objects[0] instanceof List)) {throw new IOException("The termVectors function expects a list of Tuples as a parameter.");} else {- @SuppressWarnings({"rawtypes"})- List list = (List)objects[0];+ List<?> list = (List<?>)objects[0];if(list.size() > 0) {Object o = list.get(0);if(!(o instanceof Tuple)) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/VectorFunction.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/VectorFunction.javaindex f25813b5012..7bc27163b53 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/VectorFunction.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/VectorFunction.java@@ -21,15 +21,13 @@ import java.util.List;import java.util.ArrayList;import java.util.Map;-@SuppressWarnings({"rawtypes"})-public class VectorFunction extends ArrayList {+public class VectorFunction extends ArrayList<Number> {protected static final long serialVersionUID = 1L;private Object function;- private Map context = new HashMap();+ private Map<Object, Object> context = new HashMap<>();- @SuppressWarnings({"unchecked"})public VectorFunction(Object function, double[] results) {this.function = function;for(double d : results) {@@ -37,8 +35,7 @@ public class VectorFunction extends ArrayList {}}- @SuppressWarnings({"unchecked"})- public VectorFunction(Object function, List<Number> values) {+ public VectorFunction(Object function, List<? extends Number> values) {this.function = function;addAll(values);}@@ -47,7 +44,6 @@ public class VectorFunction extends ArrayList {return this.function;}- @SuppressWarnings({"unchecked"})public void addToContext(Object key, Object value) {this.context.put(key, value);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.javaindex 08b2ee3acc7..ebee86f7985 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java@@ -94,7 +94,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {String traverseFrom,String traverseTo,String gather,- @SuppressWarnings({"rawtypes"})Map queryParams,+ Map<String,String> queryParams,List<Metric> metrics,boolean trackTraversal,Set<Traversal.Scatter> scatter,@@ -291,14 +291,13 @@ public class GatherNodesStream extends TupleStream implements Expressible {intervalParam);}- @SuppressWarnings({"unchecked"})private void init(String zkHost,String collection,TupleStream tupleStream,String traverseFrom,String traverseTo,String gather,- @SuppressWarnings({"rawtypes"})Map queryParams,+ Map<String,String> queryParams,List<Metric> metrics,boolean trackTraversal,Set<Traversal.Scatter> scatter,@@ -353,7 +352,8 @@ public class GatherNodesStream extends TupleStream implements Expressible {Set<Map.Entry<String,String>> entries = queryParams.entrySet();// parameters- for(@SuppressWarnings({"rawtypes"})Map.Entry param : entries){+ for(Map.Entry<String,String> param : entries){+ assert param.getKey() instanceof String && param.getValue() instanceof String : "Bad types passed";String value = param.getValue().toString();// SOLR-8409: This is a special case where the params contain a " character@@ -641,7 +641,6 @@ public class GatherNodesStream extends TupleStream implements Expressible {tupleStream.close();}- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {if (out == null) {@@ -660,8 +659,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {if (tuple.EOF) {if (joinBatch.size() > 0) {JoinRunner joinRunner = new JoinRunner(joinBatch);- @SuppressWarnings({"rawtypes"})- Future future = threadPool.submit(joinRunner);+ Future<List<Tuple>> future = threadPool.submit(joinRunner);futures.add(future);}break;@@ -729,8 +727,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {if (joinBatch.size() >= 400) {JoinRunner joinRunner = new JoinRunner(joinBatch);- @SuppressWarnings({"rawtypes"})- Future future = threadPool.submit(joinRunner);+ Future<List<Tuple>> future = threadPool.submit(joinRunner);futures.add(future);joinBatch = new ArrayList<>();}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.javaindex 6f2b8bd4026..f19b279c635 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java@@ -286,11 +286,10 @@ public class ShortestPathStream extends TupleStream implements Expressible {return l;}- @SuppressWarnings({"unchecked", "rawtypes"})public void open() throws IOException {List<Map<String,List<String>>> allVisited = new ArrayList<>();- Map visited = new HashMap();+ Map<String, List<String>> visited = new HashMap<>();visited.put(this.fromNode, null);allVisited.add(visited);@@ -308,10 +307,10 @@ public class ShortestPathStream extends TupleStream implements Expressible {while (targets.size() == 0 && depth < maxDepth) {Set<String> nodes = visited.keySet();Iterator<String> it = nodes.iterator();- nextVisited = new HashMap();+ nextVisited = new HashMap<>();int batchCount = 0;List<String> queryNodes = new ArrayList<>();- List<Future> futures = new ArrayList<>();+ List<Future<List<Edge>>> futures = new ArrayList<>();JOIN://Queue up all the batcheswhile (it.hasNext()) {@@ -327,7 +326,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {throw new RuntimeException(e);}batchCount = 0;- queryNodes = new ArrayList();+ queryNodes = new ArrayList<>();}}@@ -374,25 +373,25 @@ public class ShortestPathStream extends TupleStream implements Expressible {threadPool.shutdown();}- Set<String> finalPaths = new HashSet();+ Set<String> finalPaths = new HashSet<>();if(targets.size() > 0) {for(Edge edge : targets) {- List<LinkedList> paths = new ArrayList<>();- LinkedList<String> path = new LinkedList();+ List<LinkedList<String>> paths = new ArrayList<>();+ LinkedList<String> path = new LinkedList<>();path.addFirst(edge.to);paths.add(path);//Walk back up the tree a collect the parent nodes.INNER:for (int i = allVisited.size() - 1; i >= 0; --i) {Map<String, List<String>> v = allVisited.get(i);- Iterator<LinkedList> it = paths.iterator();- List newPaths = new ArrayList();+ Iterator<LinkedList<String>> it = paths.iterator();+ List<LinkedList<String>> newPaths = new ArrayList<>();while(it.hasNext()) {- LinkedList p = it.next();+ LinkedList<String> p = it.next();List<String> parents = v.get(p.peekFirst());if (parents != null) {for(String parent : parents) {- LinkedList newPath = new LinkedList(p);+ LinkedList<String> newPath = new LinkedList<>(p);newPath.addFirst(parent);newPaths.add(newPath);}@@ -401,7 +400,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {}}- for(LinkedList p : paths) {+ for(List<String> p : paths) {String s = p.toString();if (!finalPaths.contains(s)){Tuple shortestPath = new Tuple("path", p);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.javaindex e5afd4d8a62..396e0c73853 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java@@ -90,7 +90,6 @@ public class Traversal {LEAVES;}- @SuppressWarnings({"unchecked"})public Iterator<Tuple> iterator() {return new TraversalIterator(this, scatter);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.javaindex e2df8d51b6f..3f66de5e6c4 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java@@ -26,8 +26,7 @@ import java.util.Set;import org.apache.solr.client.solrj.io.Tuple;import org.apache.solr.client.solrj.io.graph.Traversal.Scatter;-@SuppressWarnings({"rawtypes"})-class TraversalIterator implements Iterator {+class TraversalIterator implements Iterator<Tuple> {private List<Map<String,Node>> graph;private List<String> collections;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GroupOperation.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GroupOperation.javaindex 70f24675c33..48c69fb5045 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GroupOperation.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GroupOperation.java@@ -46,8 +46,7 @@ public class GroupOperation implements ReduceOperation {private UUID operationNodeId = UUID.randomUUID();private PriorityQueue<Tuple> priorityQueue;- @SuppressWarnings({"rawtypes"})- private Comparator comp;+ private Comparator<Tuple> comp;private StreamComparator streamComparator;private int size;@@ -76,12 +75,11 @@ public class GroupOperation implements ReduceOperation {init(streamComparator, size);}- @SuppressWarnings({"unchecked", "rawtypes"})private void init(StreamComparator streamComparator, int size) {this.size = size;this.streamComparator = streamComparator;this.comp = new ReverseComp(streamComparator);- this.priorityQueue = new PriorityQueue(size, this.comp);+ this.priorityQueue = new PriorityQueue<>(size, this.comp);}public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {@@ -106,19 +104,15 @@ public class GroupOperation implements ReduceOperation {});}- @SuppressWarnings({"unchecked"})public Tuple reduce() {- @SuppressWarnings({"rawtypes"})- LinkedList ll = new LinkedList();+ LinkedList<Map<String,Object>> ll = new LinkedList<>();while(priorityQueue.size() > 0) {ll.addFirst(priorityQueue.poll().getFields());//This will clear priority queue and so it will be ready for the next group.}- @SuppressWarnings({"rawtypes"})- List<Map> list = new ArrayList<>(ll);- @SuppressWarnings({"rawtypes"})- Map groupHead = list.get(0);+ List<Map<String,Object>> list = new ArrayList<>(ll);+ Map<String,Object> groupHead = list.get(0);Tuple tuple = new Tuple(groupHead);tuple.put("group", list);return tuple;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.javaindex 4e4563e55df..bed96db955c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CartesianProductStream.java@@ -199,7 +199,6 @@ public class CartesianProductStream extends TupleStream implements Expressible {return generatedTuples.pop();}- @SuppressWarnings({"unchecked"})private LinkedList<Tuple> generateTupleList(Tuple original) throws IOException{Map<String, Object> evaluatedValues = new HashMap<>();@@ -217,10 +216,10 @@ public class CartesianProductStream extends TupleStream implements Expressible {for(int offset = 0; offset < workingIndexes.length; ++offset){String fieldName = evaluators.get(offset).getName();Object evaluatedValue = evaluatedValues.get(fieldName);- if(evaluatedValue instanceof Collection){+ if(evaluatedValue instanceof List){// because of the way a FieldEvaluator works we know that// any collection is a list.- generated.put(fieldName, ((List<Object>)evaluatedValue).get(workingIndexes[offset]));+ generated.put(fieldName, ((List<?>)evaluatedValue).get(workingIndexes[offset]));}}generatedTupleList.add(generated);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.javaindex 80a2211725d..e3a79eafa12 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java@@ -284,12 +284,10 @@ public class CloudSolrStream extends TupleStream implements Expressible {return solrStreams;}- @SuppressWarnings({"unchecked"})private StreamComparator parseComp(String sort, String fl) throws IOException {String[] fls = fl.split(",");- @SuppressWarnings({"rawtypes"})- HashSet fieldSet = new HashSet();+ HashSet<String> fieldSet = new HashSet<>();for(String f : fls) {fieldSet.add(f.trim()); //Handle spaces in the field list.}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/DaemonStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/DaemonStream.javaindex 2a2bc4ac96b..473e8b49286 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/DaemonStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/DaemonStream.java@@ -168,7 +168,6 @@ public class DaemonStream extends TupleStream implements Expressible {init(tupleStream, id, runInterval, queueSize, false);}- @SuppressWarnings({"unchecked", "rawtypes"})public void init(TupleStream tupleStream, String id, long runInterval, int queueSize, boolean terminate) {this.tupleStream = tupleStream;this.id = id;@@ -177,7 +176,7 @@ public class DaemonStream extends TupleStream implements Expressible {this.terminate = terminate;if(queueSize > 0) {- queue = new ArrayBlockingQueue(queueSize);+ queue = new ArrayBlockingQueue<>(queueSize);eatTuples = false;} else {eatTuples = true;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ExecutorStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ExecutorStream.javaindex 85be58fad48..0e6280ec2b9 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ExecutorStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ExecutorStream.java@@ -153,8 +153,7 @@ public class ExecutorStream extends TupleStream implements Expressible {}public Tuple read() throws IOException {- @SuppressWarnings({"unchecked", "rawtypes"})- ArrayBlockingQueue<Tuple> queue = new ArrayBlockingQueue(10000);+ ArrayBlockingQueue<Tuple> queue = new ArrayBlockingQueue<>(10000);while(true) {Tuple tuple = stream.read();if (!tuple.EOF) {@@ -184,8 +183,7 @@ public class ExecutorStream extends TupleStream implements Expressible {private StreamFactory streamFactory;private StreamContext streamContext;- @SuppressWarnings({"unchecked"})- public StreamTask(@SuppressWarnings({"rawtypes"})ArrayBlockingQueue queue, StreamFactory streamFactory, StreamContext streamContext) {+ public StreamTask(ArrayBlockingQueue<Tuple> queue, StreamFactory streamFactory, StreamContext streamContext) {this.queue = queue;this.streamFactory = streamFactory;this.streamContext = new StreamContext();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/Facet2DStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/Facet2DStream.javaindex cb19b90a704..0955c4d0c0b 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/Facet2DStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/Facet2DStream.java@@ -293,8 +293,7 @@ public class Facet2DStream extends TupleStream implements Expressible {QueryRequest request = new QueryRequest(paramsLoc, SolrRequest.METHOD.POST);try {- @SuppressWarnings({"rawtypes"})- NamedList response = cloudSolrClient.request(request, collection);+ NamedList<Object> response = cloudSolrClient.request(request, collection);getTuples(response, x, y, metric);this.out = tuples.iterator();@@ -390,27 +389,23 @@ public class Facet2DStream extends TupleStream implements Expressible {return null;}- private void getTuples(@SuppressWarnings({"rawtypes"})NamedList response, Bucket x, Bucket y, Metric metric) {+ private void getTuples(NamedList<?> response, Bucket x, Bucket y, Metric metric) {Tuple tuple = new Tuple();- @SuppressWarnings({"rawtypes"})- NamedList facets = (NamedList) response.get("facets");+ NamedList<?> facets = (NamedList<?>) response.get("facets");fillTuples(0, tuples, tuple, facets, x, y, metric);}private void fillTuples(int level, List<Tuple> tuples, Tuple currentTuple,- @SuppressWarnings({"rawtypes"})NamedList facets, Bucket x, Bucket y, Metric metric) {+ NamedList<?> facets, Bucket x, Bucket y, Metric metric) {String bucketXName = x.toString();String bucketYName = y.toString();- @SuppressWarnings({"rawtypes"})- NamedList allXBuckets = (NamedList) facets.get("x");+ NamedList<?> allXBuckets = (NamedList<?>) facets.get("x");for (int b = 0; b < allXBuckets.size(); b++) {- @SuppressWarnings({"rawtypes"})- List buckets = (List) allXBuckets.get("buckets");+ List<?> buckets = (List<?>) allXBuckets.get("buckets");for(int s=0; s<buckets.size(); s++) {- @SuppressWarnings({"rawtypes"})- NamedList bucket = (NamedList)buckets.get(s);+ NamedList<?> bucket = (NamedList<?>)buckets.get(s);Object val = bucket.get("val");if (val instanceof Integer) {val = ((Integer) val).longValue();@@ -418,14 +413,11 @@ public class Facet2DStream extends TupleStream implements Expressible {Tuple tx = currentTuple.clone();tx.put(bucketXName, val);- @SuppressWarnings({"rawtypes"})- NamedList allYBuckets = (NamedList) bucket.get("y");- @SuppressWarnings({"rawtypes"})- List ybuckets = (List)allYBuckets.get("buckets");+ NamedList<?> allYBuckets = (NamedList<?>) bucket.get("y");+ List<?> ybuckets = (List<?>)allYBuckets.get("buckets");for (int d = 0; d < ybuckets.size(); d++) {- @SuppressWarnings({"rawtypes"})- NamedList bucketY = (NamedList) ybuckets.get(d);+ NamedList<?> bucketY = (NamedList<?>) ybuckets.get(d);Object valY = bucketY.get("val");if (valY instanceof Integer) {valY = ((Integer) valY).longValue();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.javaindex 20a24bba9f1..fd66fd56637 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java@@ -589,8 +589,7 @@ public class FacetStream extends TupleStream implements Expressible, ParallelMet}try {- @SuppressWarnings({"rawtypes"})- NamedList response = cloudSolrClient.request(request, collection);+ NamedList<?> response = cloudSolrClient.request(request, collection);getTuples(response, buckets, metrics);if(resortNeeded) {@@ -803,13 +802,12 @@ public class FacetStream extends TupleStream implements Expressible, ParallelMetreturn "index";}- private void getTuples(@SuppressWarnings({"rawtypes"})NamedList response,+ private void getTuples(NamedList<?> response,Bucket[] buckets,Metric[] metrics) {Tuple tuple = new Tuple();- @SuppressWarnings({"rawtypes"})- NamedList facets = (NamedList)response.get("facets");+ NamedList<?> facets = (NamedList<?>)response.get("facets");fillTuples(0,tuples,tuple,@@ -822,21 +820,18 @@ public class FacetStream extends TupleStream implements Expressible, ParallelMetprivate void fillTuples(int level,List<Tuple> tuples,Tuple currentTuple,- @SuppressWarnings({"rawtypes"}) NamedList facets,+ NamedList<?> facets,Bucket[] _buckets,Metric[] _metrics) {String bucketName = _buckets[level].toString();- @SuppressWarnings({"rawtypes"})- NamedList nl = (NamedList)facets.get(bucketName);+ NamedList<?> nl = (NamedList<?>)facets.get(bucketName);if(nl == null) {return;}- @SuppressWarnings({"rawtypes"})- List allBuckets = (List)nl.get("buckets");+ List<?> allBuckets = (List<?>)nl.get("buckets");for(int b=0; b<allBuckets.size(); b++) {- @SuppressWarnings({"rawtypes"})- NamedList bucket = (NamedList)allBuckets.get(b);+ NamedList<?> bucket = (NamedList<?>)allBuckets.get(b);Object val = bucket.get("val");if (val instanceof Integer) {val=((Integer)val).longValue(); // calcite currently expects Long values herediff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FeaturesSelectionStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FeaturesSelectionStream.javaindex 9ed805c8cf4..a46a4e9aace 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FeaturesSelectionStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FeaturesSelectionStream.java@@ -91,7 +91,7 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{public FeaturesSelectionStream(String zkHost,String collectionName,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String,String> params,String field,String outcome,String featureSet,@@ -126,7 +126,7 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{throw new IOException(String.format(Locale.ROOT,"invalid expression %s - at least one named parameter expected. eg. 'q=*:*'",expression));}- Map<String,String> params = new HashMap<String,String>();+ Map<String,String> params = new HashMap<>();for(StreamExpressionNamedParameter namedParam : namedParams){if(!namedParam.getName().equals("zkHost")) {params.put(namedParam.getName(), namedParam.getParameter().toString().trim());@@ -213,10 +213,9 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{return expression;}- @SuppressWarnings({"unchecked"})private void init(String collectionName,String zkHost,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String, String> params,String field,String outcome,String featureSet,@@ -289,17 +288,16 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{}}- @SuppressWarnings({"rawtypes"})- private List<Future<NamedList>> callShards(List<String> baseUrls) throws IOException {+ private List<Future<NamedList<?>>> callShards(List<String> baseUrls) throws IOException {- List<Future<NamedList>> futures = new ArrayList<>();+ List<Future<NamedList<?>>> futures = new ArrayList<>();for (String baseUrl : baseUrls) {FeaturesSelectionCall lc = new FeaturesSelectionCall(baseUrl,this.params,this.field,this.outcome);- Future<NamedList> future = executorService.submit(lc);+ Future<NamedList<?>> future = executorService.submit(lc);futures.add(future);}@@ -338,9 +336,8 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{long numDocs = 0;- for (@SuppressWarnings({"rawtypes"})Future<NamedList> getTopTermsCall : callShards(getShardUrls())) {- @SuppressWarnings({"rawtypes"})- NamedList resp = getTopTermsCall.get();+ for (Future<NamedList<?>> getTopTermsCall : callShards(getShardUrls())) {+ NamedList<?> resp = getTopTermsCall.get();@SuppressWarnings({"unchecked"})NamedList<Double> shardTopTerms = (NamedList<Double>)resp.get("featuredTerms");@@ -402,8 +399,7 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{return result;}- @SuppressWarnings({"rawtypes"})- protected class FeaturesSelectionCall implements Callable<NamedList> {+ protected class FeaturesSelectionCall implements Callable<NamedList<?>> {private String baseUrl;private String outcome;@@ -421,8 +417,7 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{this.paramsMap = paramsMap;}- @SuppressWarnings({"unchecked"})- public NamedList<Double> call() throws Exception {+ public NamedList<?> call() throws Exception {ModifiableSolrParams params = new ModifiableSolrParams();HttpSolrClient solrClient = cache.getHttpSolrClient(baseUrl);@@ -440,7 +435,7 @@ public class FeaturesSelectionStream extends TupleStream implements Expressible{QueryRequest request= new QueryRequest(params);QueryResponse response = request.process(solrClient);- NamedList res = response.getResponse();+ NamedList<?> res = response.getResponse();return res;}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FetchStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FetchStream.javaindex 2a0e49c6921..ab512107121 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FetchStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FetchStream.java@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.io.stream;import java.io.IOException;import java.util.ArrayList;+import java.util.Collections;import java.util.HashMap;import java.util.Iterator;import java.util.List;@@ -204,9 +205,8 @@ public class FetchStream extends TupleStream implements Expressible {return l;}- @SuppressWarnings({"unchecked", "rawtypes"})public void open() throws IOException {- tuples = new ArrayList().iterator();+ tuples = Collections.emptyIterator();stream.open();}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/GetStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/GetStream.javaindex 2088b35fdcb..ebdfe7a441d 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/GetStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/GetStream.java@@ -99,14 +99,12 @@ public class GetStream extends TupleStream implements Expressible {public void close() throws IOException {}- @SuppressWarnings({"unchecked"})public void open() throws IOException {Map<String, Object> lets = streamContext.getLets();Object o = lets.get(name);- @SuppressWarnings({"rawtypes"})- List l = null;if(o instanceof List) {- l = (List)o;+ @SuppressWarnings("unchecked")+ List<Tuple> l = (List<Tuple>) o;tupleIterator = l.iterator();}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/HashRollupStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/HashRollupStream.javaindex 30bc59e5345..0acff346645 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/HashRollupStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/HashRollupStream.java@@ -190,7 +190,6 @@ public class HashRollupStream extends TupleStream implements Expressible {tupleIterator = null;}- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {//On the first call to read build the tupleIterator.if(tupleIterator == null) {@@ -198,8 +197,7 @@ public class HashRollupStream extends TupleStream implements Expressible {while (true) {Tuple tuple = tupleStream.read();if (tuple.EOF) {- @SuppressWarnings({"rawtypes"})- List tuples = new ArrayList();+ List<Tuple> tuples = new ArrayList<>();for(Map.Entry<HashKey, Metric[]> entry : metricMap.entrySet()) {Tuple t = new Tuple();Metric[] finishedMetrics = entry.getValue();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/JavabinTupleStreamParser.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/JavabinTupleStreamParser.javaindex f9f1790530f..2cb307405c0 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/JavabinTupleStreamParser.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/JavabinTupleStreamParser.java@@ -96,10 +96,9 @@ public class JavabinTupleStreamParser extends JavaBinCodec implements TupleStreareturn tagByte == SOLRDOCLST;}- @SuppressWarnings({"unchecked", "rawtypes"})- private Map readAsMap(DataInputInputStream dis) throws IOException {+ private Map<?,?> readAsMap(DataInputInputStream dis) throws IOException {int sz = readSize(dis);- Map m = new LinkedHashMap<>();+ Map<String, Object> m = new LinkedHashMap<>();for (int i = 0; i < sz; i++) {String name = (String) readVal(dis);Object val = readVal(dis);@@ -108,17 +107,17 @@ public class JavabinTupleStreamParser extends JavaBinCodec implements TupleStreareturn m;}- @SuppressWarnings({"unchecked", "rawtypes"})- private Map readSolrDocumentAsMap(DataInputInputStream dis) throws IOException {+ private Map<?,?> readSolrDocumentAsMap(DataInputInputStream dis) throws IOException {tagByte = dis.readByte();int size = readSize(dis);- Map doc = new LinkedHashMap<>();+ Map<String, Object> doc = new LinkedHashMap<>();for (int i = 0; i < size; i++) {String fieldName;Object obj = readVal(dis); // could be a field name, or a child documentif (obj instanceof Map) {- List l = (List) doc.get("_childDocuments_");- if (l == null) doc.put("_childDocuments_", l = new ArrayList());+ @SuppressWarnings("unchecked")+ List<Object> l = (List<Object>) doc.get("_childDocuments_");+ if (l == null) doc.put("_childDocuments_", l = new ArrayList<>());l.add(obj);continue;} else {@@ -141,7 +140,6 @@ public class JavabinTupleStreamParser extends JavaBinCodec implements TupleStreaint i = readSmallInt(dis);return (long) i;case ORDERED_MAP >>> 5:- return readAsMap(dis);case NAMED_LST >>> 5:return readAsMap(dis);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/LetStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/LetStream.javaindex 79cdcbfe8f5..5a464a2de72 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/LetStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/LetStream.java@@ -47,10 +47,8 @@ public class LetStream extends TupleStream implements Expressible {private static final long serialVersionUID = 1;private TupleStream stream;private StreamContext streamContext;- @SuppressWarnings({"rawtypes"})- private Map letParams = new LinkedHashMap();+ private Map<String, Object> letParams = new LinkedHashMap<>();- @SuppressWarnings({"unchecked", "rawtypes"})public LetStream(StreamExpression expression, StreamFactory factory) throws IOException {List<StreamExpression> streamExpressions = factory.getExpressionOperandsRepresentingTypes(expression, Expressible.class, TupleStream.class);@@ -59,13 +57,13 @@ public class LetStream extends TupleStream implements Expressible {Set<String> echo = null;boolean echoAll = false;String currentName = null;- for(StreamExpressionParameter np : namedParams) {- String name = ((StreamExpressionNamedParameter)np).getName();+ for(StreamExpressionNamedParameter np : namedParams) {+ String name = np.getName();currentName = name;if(name.equals("echo")) {- echo = new HashSet();- String echoString = ((StreamExpressionNamedParameter) np).getParameter().toString().trim();+ echo = new HashSet<>();+ String echoString = np.getParameter().toString().trim();if(echoString.equalsIgnoreCase("true")) {echoAll = true;} else {@@ -78,7 +76,7 @@ public class LetStream extends TupleStream implements Expressible {continue;}- StreamExpressionParameter param = ((StreamExpressionNamedParameter)np).getParameter();+ StreamExpressionParameter param = np.getParameter();if(param instanceof StreamExpressionValue) {String paramValue = ((StreamExpressionValue) param).getValue();@@ -162,7 +160,6 @@ public class LetStream extends TupleStream implements Expressible {stream.close();}- @SuppressWarnings({"unchecked"})public void open() throws IOException {Map<String, Object> lets = streamContext.getLets();Set<Map.Entry<String, Object>> entries = letParams.entrySet();@@ -199,8 +196,8 @@ public class LetStream extends TupleStream implements Expressible {evaluator.setStreamContext(streamContext);Object eo = evaluator.evaluate(eTuple);if(evaluator instanceof MemsetEvaluator) {- @SuppressWarnings({"rawtypes"})- Map mem = (Map)eo;+ @SuppressWarnings({"unchecked"})+ Map<String,Object> mem = (Map<String,Object>)eo;lets.putAll(mem);} else {lets.put(name, eo);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/PlotStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/PlotStream.javaindex f281536633b..52aeed290ca 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/PlotStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/PlotStream.java@@ -148,7 +148,6 @@ public class PlotStream extends TupleStream implements Expressible {return l;}- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {if (finished) {@@ -173,7 +172,9 @@ public class PlotStream extends TupleStream implements Expressible {values.put(param.getKey(), param.getValue().evaluateOverContext());}+ @SuppressWarnings({"unchecked"})List<Number> y = (List<Number>)values.get("y");+ @SuppressWarnings({"unchecked"})List<Number> x = (List<Number>)values.get("x");if(x == null) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ScoreNodesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ScoreNodesStream.javaindex bd04263b5f1..f68f232fc8c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ScoreNodesStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ScoreNodesStream.java@@ -218,8 +218,7 @@ public class ScoreNodesStream extends TupleStream implements Expressibletry {//Get the response from the terms component- @SuppressWarnings({"rawtypes"})- NamedList response = client.request(request, collection);+ NamedList<?> response = client.request(request, collection);@SuppressWarnings({"unchecked"})NamedList<Number> stats = (NamedList<Number>)response.get("indexstats");long numDocs = stats.get("numDocs").longValue();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SearchStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SearchStream.javaindex 6067783ac98..9f225ad277c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SearchStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SearchStream.java@@ -227,13 +227,12 @@ public class SearchStream extends TupleStream implements Expressible {return comp;}- @SuppressWarnings({"unchecked", "rawtypes"})private StreamComparator parseComp(String sort, String fl) throws IOException {- HashSet fieldSet = null;+ HashSet<String> fieldSet = null;if(fl != null) {- fieldSet = new HashSet();+ fieldSet = new HashSet<>();String[] fls = fl.split(",");for (String f : fls) {fieldSet.add(f.trim()); //Handle spaces in the field list.diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SelectStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SelectStream.javaindex 4f0a6c0ceaa..eeaaff0a595 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SelectStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SelectStream.java@@ -267,7 +267,7 @@ public class SelectStream extends TupleStream implements Expressible {streamContext.getTupleContext().clear();- for(Object fieldName : original.getFields().keySet()){+ for(String fieldName : original.getFields().keySet()){workingForEvaluators.put(fieldName, original.get(fieldName));if(selectedFields.containsKey(fieldName)){workingToReturn.put(selectedFields.get(fieldName), original.get(fieldName));diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.javaindex 77b187ab5d5..c2edec8bf51 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SignificantTermsStream.java@@ -77,7 +77,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{public SignificantTermsStream(String zkHost,String collectionName,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String,String> params,String field,float minDocFreq,float maxDocFreq,@@ -115,7 +115,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{throw new IOException(String.format(Locale.ROOT,"invalid expression %s - at least one named parameter expected. eg. 'q=*:*'",expression));}- Map<String,String> params = new HashMap<String,String>();+ Map<String,String> params = new HashMap<>();for(StreamExpressionNamedParameter namedParam : namedParams){if(!namedParam.getName().equals("zkHost")) {params.put(namedParam.getName(), namedParam.getParameter().toString().trim());@@ -202,10 +202,9 @@ public class SignificantTermsStream extends TupleStream implements Expressible{return expression;}- @SuppressWarnings({"unchecked"})private void init(String collectionName,String zkHost,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String,String> params,String field,float minDocFreq,float maxDocFreq,@@ -241,10 +240,9 @@ public class SignificantTermsStream extends TupleStream implements Expressible{return null;}- @SuppressWarnings({"rawtypes"})- private List<Future<NamedList>> callShards(List<String> baseUrls) throws IOException {+ private List<Future<NamedList<?>>> callShards(List<String> baseUrls) throws IOException {- List<Future<NamedList>> futures = new ArrayList<>();+ List<Future<NamedList<?>>> futures = new ArrayList<>();for (String baseUrl : baseUrls) {SignificantTermsCall lc = new SignificantTermsCall(baseUrl,this.params,@@ -254,8 +252,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{this.minTermLength,this.numTerms);- @SuppressWarnings({"rawtypes"})- Future<NamedList> future = executorService.submit(lc);+ Future<NamedList<?>> future = executorService.submit(lc);futures.add(future);}@@ -284,21 +281,21 @@ public class SignificantTermsStream extends TupleStream implements Expressible{.withExpression(toExpression(factory).toString());}- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {try {if (tupleIterator == null) {Map<String, int[]> mergeFreqs = new HashMap<>();long numDocs = 0;long resultCount = 0;- for (@SuppressWarnings({"rawtypes"})Future<NamedList> getTopTermsCall : callShards(getShards(zkHost, collection, streamContext))) {- @SuppressWarnings({"rawtypes"})- NamedList fullResp = getTopTermsCall.get();- @SuppressWarnings({"rawtypes"})- Map stResp = (Map)fullResp.get("significantTerms");+ for (Future<NamedList<?>> getTopTermsCall : callShards(getShards(zkHost, collection, streamContext))) {+ NamedList<?> fullResp = getTopTermsCall.get();+ Map<?,?> stResp = (Map<?,?>)fullResp.get("significantTerms");+ @SuppressWarnings({"unchecked"})List<String> terms = (List<String>)stResp.get("sterms");+ @SuppressWarnings({"unchecked"})List<Integer> docFreqs = (List<Integer>)stResp.get("docFreq");+ @SuppressWarnings({"unchecked"})List<Integer> queryDocFreqs = (List<Integer>)stResp.get("queryDocFreq");numDocs += (Integer)stResp.get("numDocs");@@ -351,17 +348,15 @@ public class SignificantTermsStream extends TupleStream implements Expressible{}}- @SuppressWarnings({"rawtypes"})- private static class ScoreComp implements Comparator<Map> {- public int compare(Map a, Map b) {+ private static class ScoreComp implements Comparator<Map<String, ?>> {+ public int compare(Map<String, ?> a, Map<String, ?> b) {Float scorea = (Float)a.get("score");Float scoreb = (Float)b.get("score");return scoreb.compareTo(scorea);}}- @SuppressWarnings({"unchecked", "rawtypes"})- protected class SignificantTermsCall implements Callable<NamedList> {+ protected class SignificantTermsCall implements Callable<NamedList<?>> {private String baseUrl;private String field;@@ -388,8 +383,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{this.minTermLength = minTermLength;}- @SuppressWarnings({"unchecked", "rawtypes"})- public NamedList<Double> call() throws Exception {+ public NamedList<?> call() throws Exception {ModifiableSolrParams params = new ModifiableSolrParams();HttpSolrClient solrClient = cache.getHttpSolrClient(baseUrl);@@ -411,7 +405,7 @@ public class SignificantTermsStream extends TupleStream implements Expressible{QueryRequest request= new QueryRequest(params, SolrRequest.METHOD.POST);QueryResponse response = request.process(solrClient);- NamedList res = response.getResponse();+ NamedList<?> res = response.getResponse();return res;}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.javaindex 27fc622f93b..3a0375b34b2 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java@@ -205,11 +205,9 @@ public class SolrStream extends TupleStream {* Reads a Tuple from the stream. The Stream is completed when Tuple.EOF == true.**/- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {try {- @SuppressWarnings({"rawtypes"})- Map fields = tupleStreamParser.next();+ Map<String, Object> fields = tupleStreamParser.next();if (fields == null) {//Return the EOF tuple.@@ -261,17 +259,16 @@ public class SolrStream extends TupleStream {return null;}- @SuppressWarnings({"unchecked", "rawtypes"})- private Map mapFields(Map fields, Map<String,String> mappings) {+ private <V> Map<String, V> mapFields(Map<String, V> fields, Map<String,String> mappings) {Iterator<Map.Entry<String,String>> it = mappings.entrySet().iterator();while(it.hasNext()) {Map.Entry<String,String> entry = it.next();String mapFrom = entry.getKey();String mapTo = entry.getValue();- Object o = fields.get(mapFrom);+ V v = fields.get(mapFrom);fields.remove(mapFrom);- fields.put(mapTo, o);+ fields.put(mapTo, v);}return fields;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StatsStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StatsStream.javaindex 26bc861376b..778ee82bb98 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StatsStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StatsStream.java@@ -225,8 +225,7 @@ public class StatsStream extends TupleStream implements Expressible {QueryRequest request = new QueryRequest(paramsLoc, SolrRequest.METHOD.POST);cloudSolrClient = cache.getCloudSolrClient(zkHost);try {- @SuppressWarnings({"rawtypes"})- NamedList response = cloudSolrClient.request(request, collection);+ NamedList<?> response = cloudSolrClient.request(request, collection);getTuples(response, metrics);} catch (Exception e) {throw new IOException(e);@@ -243,8 +242,7 @@ public class StatsStream extends TupleStream implements Expressible {QueryRequest request = new QueryRequest(paramsLoc, SolrRequest.METHOD.POST);try {- @SuppressWarnings({"rawtypes"})- NamedList response = client.request(request);+ NamedList<?> response = client.request(request);getTuples(response, metrics);} catch (Exception e) {throw new IOException(e);@@ -306,17 +304,16 @@ public class StatsStream extends TupleStream implements Expressible {}}- private void getTuples(@SuppressWarnings({"rawtypes"})NamedList response,+ private void getTuples(NamedList<?> response,Metric[] metrics) {this.tuple = new Tuple();- @SuppressWarnings({"rawtypes"})- NamedList facets = (NamedList)response.get("facets");+ NamedList<?> facets = (NamedList<?>)response.get("facets");fillTuple(tuple, facets, metrics);}private void fillTuple(Tuple t,- @SuppressWarnings({"rawtypes"})NamedList nl,+ NamedList<?> nl,Metric[] _metrics) {if(nl == null) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StreamContext.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StreamContext.javaindex 677a6613a6a..da413da1769 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StreamContext.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/StreamContext.java@@ -41,8 +41,7 @@ public class StreamContext implements Serializable {private Map<String, Object> entries = new HashMap<String, Object>();private Map<String, String> tupleContext = new HashMap<>();private Map<String, Object> lets = new HashMap<>();- // TODO: This might be ok as a Map<String, Map<String, Object>>- private ConcurrentMap<String, Object> objectCache;+ private ConcurrentMap<String, ConcurrentMap<String,Object>> objectCache;public int workerID;public int numWorkers;private SolrClientCache clientCache;@@ -52,11 +51,11 @@ public class StreamContext implements Serializable {private SolrParams requestParams;private RequestReplicaListTransformerGenerator requestReplicaListTransformerGenerator;- public ConcurrentMap<String, Object> getObjectCache() {+ public ConcurrentMap<String, ConcurrentMap<String,Object>> getObjectCache() {return this.objectCache;}- public void setObjectCache(ConcurrentMap<String, Object> objectCache) {+ public void setObjectCache(ConcurrentMap<String, ConcurrentMap<String,Object>> objectCache) {this.objectCache = objectCache;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TextLogitStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TextLogitStream.javaindex 6949d809e78..e641df5aa21 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TextLogitStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TextLogitStream.java@@ -99,7 +99,7 @@ public class TextLogitStream extends TupleStream implements Expressible {public TextLogitStream(String zkHost,String collectionName,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String,String> params,String name,String field,TupleStream termsStream,@@ -283,10 +283,9 @@ public class TextLogitStream extends TupleStream implements Expressible {return expression;}- @SuppressWarnings({"unchecked"})private void init(String collectionName,String zkHost,- @SuppressWarnings({"rawtypes"})Map params,+ Map<String,String> params,String name,String feature,TupleStream termsStream,@@ -439,7 +438,6 @@ public class TextLogitStream extends TupleStream implements Expressible {}}- @SuppressWarnings({"unchecked"})public Tuple read() throws IOException {try {@@ -462,17 +460,17 @@ public class TextLogitStream extends TupleStream implements Expressible {for (Future<Tuple> logitCall : callShards(getShardUrls())) {Tuple tuple = logitCall.get();+ @SuppressWarnings({"unchecked"})List<Double> shardWeights = (List<Double>) tuple.get("weights");allWeights.add(shardWeights);this.error += tuple.getDouble("error");- @SuppressWarnings({"rawtypes"})- Map shardEvaluation = (Map) tuple.get("evaluation");+ @SuppressWarnings({"unchecked"})+ Map<String, Object> shardEvaluation = (Map<String, Object>) tuple.get("evaluation");this.evaluation.addEvaluation(shardEvaluation);}this.weights = averageWeights(allWeights);- @SuppressWarnings({"rawtypes"})- Map map = new HashMap();+ Map<String, Object> map = new HashMap<>();map.put(ID, name+"_"+iteration);map.put("name_s", name);map.put("field_s", field);@@ -526,7 +524,7 @@ public class TextLogitStream extends TupleStream implements Expressible {return ave;}- static String toString(@SuppressWarnings({"rawtypes"})List items) {+ static String toString(List<?> items) {StringBuilder buf = new StringBuilder();for(Object item : items) {if(buf.length() > 0) {@@ -644,11 +642,9 @@ public class TextLogitStream extends TupleStream implements Expressible {QueryRequest request= new QueryRequest(params, SolrRequest.METHOD.POST);QueryResponse response = request.process(solrClient);- @SuppressWarnings({"rawtypes"})- NamedList res = response.getResponse();+ NamedList<?> res = response.getResponse();- @SuppressWarnings({"rawtypes"})- NamedList logit = (NamedList)res.get("logit");+ NamedList<?> logit = (NamedList<?>)res.get("logit");@SuppressWarnings({"unchecked"})List<Double> shardWeights = (List<Double>)logit.get("weights");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.javaindex 0caea17ea5b..747ba9c394b 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java@@ -332,8 +332,7 @@ public class TimeSeriesStream extends TupleStream implements Expressible {QueryRequest request = new QueryRequest(paramsLoc, SolrRequest.METHOD.POST);try {- @SuppressWarnings({"rawtypes"})- NamedList response = cloudSolrClient.request(request, collection);+ NamedList<?> response = cloudSolrClient.request(request, collection);getTuples(response, field, metrics);} catch (Exception e) {throw new IOException(e);@@ -444,32 +443,29 @@ public class TimeSeriesStream extends TupleStream implements Expressible {buf.append("}}");}- private void getTuples(@SuppressWarnings({"rawtypes"})NamedList response,+ private void getTuples(NamedList<?> response,String field,Metric[] metrics) {Tuple tuple = new Tuple();- @SuppressWarnings({"rawtypes"})- NamedList facets = (NamedList)response.get("facets");+ NamedList<?> facets = (NamedList<?>)response.get("facets");fillTuples(tuples, tuple, facets, field, metrics);}private void fillTuples(List<Tuple> tuples,Tuple currentTuple,- @SuppressWarnings({"rawtypes"})NamedList facets,+ NamedList<?> facets,String field,Metric[] _metrics) {- @SuppressWarnings({"rawtypes"})- NamedList nl = (NamedList)facets.get("timeseries");+ NamedList<?> nl = (NamedList<?>)facets.get("timeseries");if(nl == null) {return;}- @SuppressWarnings({"rawtypes"})- List allBuckets = (List)nl.get("buckets");+ @SuppressWarnings("unchecked")+ List<NamedList<?>> allBuckets = (List<NamedList<?>>)nl.get("buckets");for(int b=0; b<allBuckets.size(); b++) {- @SuppressWarnings({"rawtypes"})- NamedList bucket = (NamedList)allBuckets.get(b);+ NamedList<?> bucket = allBuckets.get(b);Object val = bucket.get("val");Tuple tx = currentTuple.clone();@@ -481,16 +477,14 @@ public class TimeSeriesStream extends TupleStream implements Expressible {tx.put(field, val);if(split != null) {- @SuppressWarnings({"rawtypes"})- NamedList splitBuckets = (NamedList) bucket.get("split");+ NamedList<?> splitBuckets = (NamedList<?>) bucket.get("split");if(splitBuckets == null) {continue;}- @SuppressWarnings({"rawtypes"})- List sbuckets = (List)splitBuckets.get("buckets");+ @SuppressWarnings({"unchecked"})+ List<NamedList<?>> sbuckets = (List<NamedList<?>>)splitBuckets.get("buckets");for (int d = 0; d < sbuckets.size(); d++) {- @SuppressWarnings({"rawtypes"})- NamedList bucketS = (NamedList) sbuckets.get(d);+ NamedList<?> bucketS = sbuckets.get(d);Object valS = bucketS.get("val");if (valS instanceof Integer) {valS = ((Integer) valS).longValue();diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupStream.javaindex 769b6966aaf..bd8b5f56537 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupStream.java@@ -174,7 +174,6 @@ public class TupStream extends TupleStream implements Expressible {// Nothing to do here}- @SuppressWarnings({"unchecked"})public void open() throws IOException {Map<String, Object> values = new HashMap<>();@@ -222,9 +221,9 @@ public class TupStream extends TupleStream implements Expressible {if(o instanceof Tuple) {unnestedTuple = (Tuple)o;} else if(o instanceof List) {- @SuppressWarnings({"rawtypes"})- List l = (List)o;+ List<?> l = (List<?>)o;if(l.size() > 0 && l.get(0) instanceof Tuple) {+ @SuppressWarnings({"unchecked"})List<Tuple> tl = (List<Tuple>)l;unnestedTuples = tl.iterator();}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupleStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupleStream.javaindex 0e48abe64b6..b70d54820c5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupleStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TupleStream.java@@ -183,7 +183,6 @@ public abstract class TupleStream implements Closeable, Serializable, MapWriterreturn replicas;}- @SuppressWarnings({"unchecked"})public static List<String> getShards(String zkHost,String collection,StreamContext streamContext,@@ -191,6 +190,7 @@ public abstract class TupleStream implements Closeable, Serializable, MapWriterthrows IOException {List<String> shards;+ @SuppressWarnings({"unchecked"})Map<String, List<String>> shardsMap = streamContext != null ? (Map<String, List<String>>)streamContext.get("shards") : null;if(shardsMap != null) {//Manual Shardingdiff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/UpdateStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/UpdateStream.javaindex f309f194b62..90fed9dc983 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/UpdateStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/UpdateStream.java@@ -294,17 +294,16 @@ public class UpdateStream extends TupleStream implements Expressible {}}- @SuppressWarnings({"unchecked"})private SolrInputDocument convertTupleToSolrDocument(Tuple tuple) {SolrInputDocument doc = new SolrInputDocument();- for (Object field : tuple.getFields().keySet()) {+ for (String field : tuple.getFields().keySet()) {if (! (field.equals(CommonParams.VERSION_FIELD) && pruneVersionField)) {Object value = tuple.get(field);if (value instanceof List) {- addMultivaluedField(doc, (String)field, (List<Object>)value);+ addMultivaluedField(doc, field, (List<?>)value);} else {- doc.addField((String)field, tuple.get(field));+ doc.addField(field, value);}}}@@ -313,7 +312,7 @@ public class UpdateStream extends TupleStream implements Expressible {return doc;}- private void addMultivaluedField(SolrInputDocument doc, String fieldName, List<Object> values) {+ private void addMultivaluedField(SolrInputDocument doc, String fieldName, List<?> values) {for (Object value : values) {doc.addField(fieldName, value);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ZplotStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ZplotStream.javaindex 95fb6268a99..efa975d634d 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ZplotStream.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/ZplotStream.java@@ -54,18 +54,17 @@ public class ZplotStream extends TupleStream implements Expressible {private static final long serialVersionUID = 1;private StreamContext streamContext;@SuppressWarnings({"rawtypes"})- private Map letParams = new LinkedHashMap();+ private Map<String, Object> letParams = new LinkedHashMap<>();private Iterator<Tuple> out;- @SuppressWarnings({"unchecked"})public ZplotStream(StreamExpression expression, StreamFactory factory) throws IOException {List<StreamExpressionNamedParameter> namedParams = factory.getNamedOperands(expression);//Get all the named params- for(StreamExpressionParameter np : namedParams) {- String name = ((StreamExpressionNamedParameter)np).getName();- StreamExpressionParameter param = ((StreamExpressionNamedParameter)np).getParameter();+ for(StreamExpressionNamedParameter np : namedParams) {+ String name = np.getName();+ StreamExpressionParameter param = np.getParameter();if(param instanceof StreamExpressionValue) {String paramValue = ((StreamExpressionValue) param).getValue();letParams.put(name, factory.constructPrimitiveObject(paramValue));@@ -120,7 +119,6 @@ public class ZplotStream extends TupleStream implements Expressible {public void close() throws IOException {}- @SuppressWarnings({"unchecked", "rawtypes"})public void open() throws IOException {Map<String, Object> lets = streamContext.getLets();Set<Map.Entry<String, Object>> entries = letParams.entrySet();@@ -155,7 +153,7 @@ public class ZplotStream extends TupleStream implements Expressible {evaluator.setStreamContext(streamContext);Object eo = evaluator.evaluate(eTuple);if(eo instanceof List) {- List l = (List)eo;+ List<?> l = (List<?>)eo;if(numTuples == -1) {numTuples = l.size();} else {@@ -172,7 +170,7 @@ public class ZplotStream extends TupleStream implements Expressible {} else {Object eval = lets.get(o);if(eval instanceof List) {- List l = (List)eval;+ List<?> l = (List<?>)eval;if(numTuples == -1) {numTuples = l.size();} else {@@ -200,7 +198,7 @@ public class ZplotStream extends TupleStream implements Expressible {for (int i = 0; i < numTuples; i++) {Tuple tuple = new Tuple();for (Map.Entry<String, Object> entry : evaluated.entrySet()) {- List l = (List) entry.getValue();+ List<?> l = (List<?>) entry.getValue();tuple.put(entry.getKey(), l.get(i));}@@ -289,7 +287,7 @@ public class ZplotStream extends TupleStream implements Expressible {frequency.addValue(i);}- Iterator it = frequency.valuesIterator();+ Iterator<?> it = frequency.valuesIterator();List<Long> values = new ArrayList<>();while(it.hasNext()) {values.add((Long)it.next());@@ -308,8 +306,9 @@ public class ZplotStream extends TupleStream implements Expressible {outTuples.add(tuple);}} else if(o instanceof List) {- List list = (List)o;+ List<?> list = (List<?>)o;if(list.get(0) instanceof Tuple) {+ @SuppressWarnings({"unchecked"})List<Tuple> tlist = (List<Tuple>)o;Tuple tuple = tlist.get(0);if(tuple.getFields().containsKey("N")) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.javaindex 273f447d2f9..d37cdcfe57b 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java@@ -19,7 +19,6 @@ package org.apache.solr.client.solrj.request;import org.apache.solr.client.solrj.RoutedAliasTypes;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.SolrRequest;-import org.apache.solr.client.solrj.SolrResponse;import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.request.beans.DeleteBackupPayload;import org.apache.solr.client.solrj.request.beans.ListBackupPayload;@@ -271,8 +270,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>}}- @SuppressWarnings({"rawtypes"})- protected abstract static class ShardSpecificAdminRequest extends CollectionAdminRequest {+ protected abstract static class ShardSpecificAdminRequest extends CollectionAdminRequest<CollectionAdminResponse> {protected String collection;protected String shard;@@ -293,7 +291,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>}@Override- protected SolrResponse createResponse(SolrClient client) {+ protected CollectionAdminResponse createResponse(SolrClient client) {return new CollectionAdminResponse();}}@@ -1561,8 +1559,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>public static class RequestStatusResponse extends CollectionAdminResponse {public RequestStatusState getRequestStatus() {- @SuppressWarnings({"rawtypes"})- NamedList innerResponse = (NamedList) getResponse().get("status");+ NamedList<?> innerResponse = (NamedList<?>) getResponse().get("status");return RequestStatusState.fromKey((String) innerResponse.get("state"));}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionApiMapping.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionApiMapping.javaindex 76e4b1c1d0a..500200d072e 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionApiMapping.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionApiMapping.java@@ -222,11 +222,11 @@ public class CollectionApiMapping {String getSpecName();}- @SuppressWarnings({"unchecked", "rawtypes"})private static Collection<String> getParamNames_(CommandOperation op, CommandMeta command) {Object o = op.getCommandData();if (o instanceof Map) {- Map map = (Map) o;+ @SuppressWarnings("unchecked")+ Map<String,Object> map = (Map<String, Object>) o;List<String> result = new ArrayList<>();collectKeyNames(map, result, "");return result;@@ -239,7 +239,7 @@ public class CollectionApiMapping {public static void collectKeyNames(Map<String, Object> map, List<String> result, String prefix) {for (Map.Entry<String, Object> e : map.entrySet()) {if (e.getValue() instanceof Map) {- collectKeyNames((Map) e.getValue(), result, prefix + e.getKey() + ".");+ collectKeyNames((Map<String, Object>) e.getValue(), result, prefix + e.getKey() + ".");} else {result.add(prefix + e.getKey());}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.javaindex e171aa12851..233f99beeeb 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java@@ -40,8 +40,7 @@ public abstract class ConfigSetAdminRequestprotected ConfigSetAction action = null;- @SuppressWarnings({"rawtypes"})- protected ConfigSetAdminRequest setAction(ConfigSetAction action) {+ protected ConfigSetAdminRequest<Q,R> setAction(ConfigSetAction action) {this.action = action;return this;}@@ -145,7 +144,7 @@ public abstract class ConfigSetAdminRequestparams.set("baseConfigSet", baseConfigSetName);}if (properties != null) {- for (@SuppressWarnings({"rawtypes"})Map.Entry entry : properties.entrySet()) {+ for (Map.Entry<?,?> entry : properties.entrySet()) {params.set(PROPERTY_PREFIX + "." + entry.getKey().toString(),entry.getValue().toString());}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.javaindex 6285ce6cb04..8147cc2d7ab 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java@@ -71,12 +71,9 @@ public class JavaBinUpdateRequestCodec {** @throws IOException in case of an exception during marshalling or writing to the stream*/- @SuppressWarnings({"unchecked"})public void marshal(UpdateRequest updateRequest, OutputStream os) throws IOException {- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();- @SuppressWarnings({"rawtypes"})- NamedList params = solrParamsToNamedList(updateRequest.getParams());+ NamedList<Object> nl = new NamedList<>();+ NamedList<Object> params = solrParamsToNamedList(updateRequest.getParams());if (updateRequest.getCommitWithin() != -1) {params.add("commitWithin", updateRequest.getCommitWithin());}@@ -118,15 +115,15 @@ public class JavaBinUpdateRequestCodec {** @throws IOException in case of an exception while reading from the input stream or unmarshalling*/- @SuppressWarnings({"unchecked", "rawtypes"})+ @SuppressWarnings({"unchecked"})public UpdateRequest unmarshal(InputStream is, final StreamingUpdateHandler handler) throws IOException {final UpdateRequest updateRequest = new UpdateRequest();- List<List<NamedList>> doclist;+ List<List<NamedList<?>>> doclist;List<Entry<SolrInputDocument,Map<Object,Object>>> docMap;List<String> delById;Map<String,Map<String,Object>> delByIdMap;List<String> delByQ;- final NamedList[] namedList = new NamedList[1];+ final NamedList<?>[] namedList = new NamedList<?>[1];try (JavaBinCodec codec = new StreamingCodec(namedList, updateRequest, handler)) {codec.unmarshal(is);}@@ -134,7 +131,7 @@ public class JavaBinUpdateRequestCodec {// NOTE: if the update request contains only delete commands the params// must be loaded nowif(updateRequest.getParams()==null) {- NamedList params = (NamedList) namedList[0].get("params");+ NamedList<?> params = (NamedList<?>) namedList[0].get("params");if(params!=null) {updateRequest.setParams(new ModifiableSolrParams(params.toSolrParams()));}@@ -146,7 +143,7 @@ public class JavaBinUpdateRequestCodec {Object docsMapObj = namedList[0].get("docsMap");if (docsMapObj instanceof Map) {//SOLR-5762- docMap = new ArrayList(((Map)docsMapObj).entrySet());+ docMap = new ArrayList<>(((Map)docsMapObj).entrySet());} else {docMap = (List<Entry<SolrInputDocument, Map<Object, Object>>>) docsMapObj;}@@ -185,9 +182,8 @@ public class JavaBinUpdateRequestCodec {}- @SuppressWarnings({"rawtypes"})- private NamedList solrParamsToNamedList(SolrParams params) {- if (params == null) return new NamedList();+ private NamedList<Object> solrParamsToNamedList(SolrParams params) {+ if (params == null) return new NamedList<>();return params.toNamedList();}@@ -209,8 +205,8 @@ public class JavaBinUpdateRequestCodec {class StreamingCodec extends JavaBinCodec {- @SuppressWarnings({"rawtypes"})- private final NamedList[] namedList;+ // TODO This could probably be an AtomicReference<NamedList<?>>+ private final NamedList<?>[] namedList;private final UpdateRequest updateRequest;private final StreamingUpdateHandler handler;// NOTE: this only works because this is an anonymous inner class@@ -218,7 +214,7 @@ public class JavaBinUpdateRequestCodec {// is ever refactored, this will not work.private boolean seenOuterMostDocIterator;- public StreamingCodec(@SuppressWarnings({"rawtypes"})NamedList[] namedList, UpdateRequest updateRequest, StreamingUpdateHandler handler) {+ public StreamingCodec(NamedList<?>[] namedList, UpdateRequest updateRequest, StreamingUpdateHandler handler) {this.namedList = namedList;this.updateRequest = updateRequest;this.handler = handler;@@ -226,16 +222,14 @@ public class JavaBinUpdateRequestCodec {}@Override- @SuppressWarnings({"unchecked", "rawtypes"})protected SolrInputDocument createSolrInputDocument(int sz) {- return new MaskCharSequenceSolrInputDoc(new LinkedHashMap(sz));+ return new MaskCharSequenceSolrInputDoc(new LinkedHashMap<>(sz));}@Override- @SuppressWarnings({"unchecked", "rawtypes"})- public NamedList readNamedList(DataInputInputStream dis) throws IOException {+ public NamedList<Object> readNamedList(DataInputInputStream dis) throws IOException {int sz = readSize(dis);- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();if (namedList[0] == null) {namedList[0] = nl;}@@ -247,11 +241,10 @@ public class JavaBinUpdateRequestCodec {return nl;}- @SuppressWarnings({"rawtypes"})- private SolrInputDocument listToSolrInputDocument(List<NamedList> namedList) {+ private SolrInputDocument listToSolrInputDocument(List<NamedList<?>> namedList) {SolrInputDocument doc = new SolrInputDocument();for (int i = 0; i < namedList.size(); i++) {- NamedList nl = namedList.get(i);+ NamedList<?> nl = namedList.get(i);if (i == 0) {Float boost = (Float) nl.getVal(0);if (boost != null && boost.floatValue() != 1f) {@@ -280,8 +273,7 @@ public class JavaBinUpdateRequestCodec {}@Override- @SuppressWarnings({"unchecked", "rawtypes"})- public List readIterator(DataInputInputStream fis) throws IOException {+ public List<Object> readIterator(DataInputInputStream fis) throws IOException {// default behavior for reading any regular Iterator in the streamif (seenOuterMostDocIterator) return super.readIterator(fis);@@ -292,11 +284,10 @@ public class JavaBinUpdateRequestCodec {}- @SuppressWarnings({"unchecked", "rawtypes"})- private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException {- if(namedList[0] == null) namedList[0] = new NamedList();- NamedList params = (NamedList) namedList[0].get("params");- if (params == null) params = new NamedList();+ private List<Object> readOuterMostDocIterator(DataInputInputStream fis) throws IOException {+ if(namedList[0] == null) namedList[0] = new NamedList<>();+ NamedList<?> params = (NamedList<?>) namedList[0].get("params");+ if (params == null) params = new NamedList<>();updateRequest.setParams(new ModifiableSolrParams(params.toSolrParams()));if (handler == null) return super.readIterator(fis);Integer commitWithin = null;@@ -315,14 +306,18 @@ public class JavaBinUpdateRequestCodec {SolrInputDocument sdoc = null;if (o instanceof List) {- sdoc = listToSolrInputDocument((List<NamedList>) o);+ @SuppressWarnings("unchecked")+ List<NamedList<?>> list = (List<NamedList<?>>) o;+ sdoc = listToSolrInputDocument(list);} else if (o instanceof NamedList) {UpdateRequest req = new UpdateRequest();req.setParams(new ModifiableSolrParams(((NamedList) o).toSolrParams()));handler.update(null, req, null, null);} else if (o instanceof Map.Entry) {- sdoc = (SolrInputDocument) ((Entry) o).getKey();- Map p = (Map) ((Entry) o).getValue();+ @SuppressWarnings("unchecked")+ Map.Entry<SolrInputDocument, Map<?,?>> entry = (Map.Entry<SolrInputDocument, Map<?, ?>>) o;+ sdoc = entry.getKey();+ Map<?,?> p = entry.getValue();if (p != null) {commitWithin = (Integer) p.get(UpdateRequest.COMMIT_WITHIN);overwrite = (Boolean) p.get(UpdateRequest.OVERWRITE);@@ -349,21 +344,19 @@ public class JavaBinUpdateRequestCodec {}}- @SuppressWarnings({"unchecked"})- private SolrInputDocument convertMapToSolrInputDoc(@SuppressWarnings({"rawtypes"})Map m) {+ private SolrInputDocument convertMapToSolrInputDoc(Map<?,?> m) {SolrInputDocument result = createSolrInputDocument(m.size());m.forEach((k, v) -> {if (CHILDDOC.equals(k.toString())) {if (v instanceof List) {- @SuppressWarnings({"rawtypes"})- List list = (List) v;+ List<?> list = (List<?>) v;for (Object o : list) {if (o instanceof Map) {- result.addChildDocument(convertMapToSolrInputDoc((Map) o));+ result.addChildDocument(convertMapToSolrInputDoc((Map<?,?>) o));}}} else if (v instanceof Map) {- result.addChildDocument(convertMapToSolrInputDoc((Map) v));+ result.addChildDocument(convertMapToSolrInputDoc((Map<?,?>) v));}} else {result.addField(k.toString(), v);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/MultiContentWriterRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/MultiContentWriterRequest.javaindex 9e2646f68ce..631011fee34 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/MultiContentWriterRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/MultiContentWriterRequest.java@@ -38,8 +38,7 @@ import static org.apache.solr.common.params.UpdateParams.ASSUME_CONTENT_TYPE;public class MultiContentWriterRequest extends AbstractUpdateRequest {- @SuppressWarnings({"rawtypes"})- private final Iterator<Pair<NamedList, Object>> payload;+ private final Iterator<Pair<NamedList<String>, Object>> payload;/***@@ -49,7 +48,7 @@ public class MultiContentWriterRequest extends AbstractUpdateRequest {*/public MultiContentWriterRequest(METHOD m, String path,- @SuppressWarnings({"rawtypes"})Iterator<Pair<NamedList, Object>> payload) {+ Iterator<Pair<NamedList<String>, Object>> payload) {super(m, path);params = new ModifiableSolrParams();params.add("multistream", "true");@@ -61,16 +60,13 @@ public class MultiContentWriterRequest extends AbstractUpdateRequest {public RequestWriter.ContentWriter getContentWriter(String expectedType) {return new RequestWriter.ContentWriter() {@Override- @SuppressWarnings({"unchecked"})public void write(OutputStream os) throws IOException {new JavaBinCodec().marshal((IteratorWriter) iw -> {while (payload.hasNext()) {- @SuppressWarnings({"rawtypes"})- Pair<NamedList, Object> next = payload.next();+ Pair<NamedList<String>, Object> next = payload.next();if (next.second() instanceof ByteBuffer || next.second() instanceof byte[]) {- @SuppressWarnings({"rawtypes"})- NamedList params = next.first();+ NamedList<String> params = next.first();if(params.get(ASSUME_CONTENT_TYPE) == null){String detectedType = detect(next.second());if(detectedType==null){diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.javaindex 3838ed6fa5e..bb27f11a1dc 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java@@ -52,7 +52,7 @@ public class RequestWriter {* {@link org.apache.solr.client.solrj.request.RequestWriter#getContentStreams(SolrRequest)} is* invoked to do a pull write.*/- public ContentWriter getContentWriter(@SuppressWarnings({"rawtypes"})SolrRequest req) {+ public ContentWriter getContentWriter(SolrRequest<?> req) {if (req instanceof UpdateRequest) {UpdateRequest updateRequest = (UpdateRequest) req;if (isEmpty(updateRequest)) return null;@@ -77,8 +77,7 @@ public class RequestWriter {* @deprecated Use {@link #getContentWriter(SolrRequest)}.*/@Deprecated- @SuppressWarnings({"unchecked"})- public Collection<ContentStream> getContentStreams(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {+ public Collection<ContentStream> getContentStreams(SolrRequest<?> req) throws IOException {if (req instanceof UpdateRequest) {return null;}@@ -130,11 +129,11 @@ public class RequestWriter {}}- protected boolean isNull(@SuppressWarnings({"rawtypes"})List l) {+ protected boolean isNull(List<?> l) {return l == null || l.isEmpty();}- protected boolean isNull(@SuppressWarnings({"rawtypes"})Map l) {+ protected boolean isNull(Map<?,?> l) {return l == null || l.isEmpty();}}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/V1toV2ApiMapper.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/V1toV2ApiMapper.javaindex 0cfaf201b75..27ede3feb52 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/V1toV2ApiMapper.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/V1toV2ApiMapper.java@@ -84,8 +84,7 @@ public class V1toV2ApiMapper {public V2Request.Builder convert(SolrParams paramsV1) {String[] list = new String[template.variables.size()];MapWriter data = serializeToV2Format(paramsV1, list);- @SuppressWarnings({"rawtypes"})- Map o = data.toMap(new LinkedHashMap<>());+ Map<String, Object> o = data.toMap(new LinkedHashMap<>());return new V2Request.Builder(template.apply(s -> {int idx = template.variables.indexOf(s);return list[idx];diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/AnalysisResponseBase.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/AnalysisResponseBase.javaindex e238dcc21bf..58644a809a1 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/AnalysisResponseBase.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/AnalysisResponseBase.java@@ -75,8 +75,8 @@ public class AnalysisResponseBase extends SolrResponseBase {phase.addTokenInfo(tokenInfo);} else {@SuppressWarnings({"unchecked"})- List<NamedList<Object>> tokens = (List<NamedList<Object>>) phaseEntry.getValue();- for (NamedList<Object> token : tokens) {+ List<NamedList<?>> tokens = (List<NamedList<?>>) phaseEntry.getValue();+ for (NamedList<?> token : tokens) {TokenInfo tokenInfo = buildTokenInfo(token);phase.addTokenInfo(tokenInfo);}@@ -114,7 +114,7 @@ public class AnalysisResponseBase extends SolrResponseBase {** @return The built token info.*/- protected TokenInfo buildTokenInfo(NamedList<Object> tokenNL) {+ protected TokenInfo buildTokenInfo(NamedList<?> tokenNL) {String text = (String) tokenNL.get("text");String rawText = (String) tokenNL.get("rawText");String type = (String) tokenNL.get("type");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/DelegationTokenResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/DelegationTokenResponse.javaindex 140e1c04757..0848c6891bc 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/DelegationTokenResponse.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/DelegationTokenResponse.java@@ -40,8 +40,7 @@ public abstract class DelegationTokenResponse extends SolrResponseBase {*/public String getDelegationToken() {try {- @SuppressWarnings({"rawtypes"})- Map map = (Map)getResponse().get("Token");+ Map<?,?> map = (Map<?,?>)getResponse().get("Token");if (map != null) {return (String)map.get("urlString");}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SolrResponseBase.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SolrResponseBase.javaindex d030f8b6d6e..be8f0d803d8 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SolrResponseBase.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SolrResponseBase.java@@ -62,15 +62,13 @@ public class SolrResponseBase extends SolrResponse implements MapWriterreturn response.toString();}- @SuppressWarnings({"rawtypes"})- public NamedList getResponseHeader() {- return (NamedList) response.get("responseHeader");+ public NamedList<?> getResponseHeader() {+ return (NamedList<?>) response.get("responseHeader");}// these two methods are based on the logic in SolrCore.setResponseHeaderValues(...)public int getStatus() {- @SuppressWarnings({"rawtypes"})- NamedList header = getResponseHeader();+ NamedList<?> header = getResponseHeader();if (header != null) {return (Integer) header.get("status");}@@ -80,8 +78,7 @@ public class SolrResponseBase extends SolrResponse implements MapWriter}public int getQTime() {- @SuppressWarnings({"rawtypes"})- NamedList header = getResponseHeader();+ NamedList<?> header = getResponseHeader();if (header != null) {return (Integer) header.get("QTime");}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.javaindex 1a1cfb023dd..778dda8dab5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java@@ -145,7 +145,6 @@ public class SpellCheckResponse {private List<String> alternatives = new ArrayList<>();private List<Integer> alternativeFrequencies;- @SuppressWarnings({"rawtypes"})public Suggestion(String token, NamedList<Object> suggestion) {this.token = token;for (int i = 0; i < suggestion.size(); i++) {@@ -160,13 +159,13 @@ public class SpellCheckResponse {} else if ("origFreq".equals(n)) {originalFrequency = (Integer) suggestion.getVal(i);} else if ("suggestion".equals(n)) {- List list = (List)suggestion.getVal(i);+ List<?> list = (List<?>)suggestion.getVal(i);if (list.size() > 0 && list.get(0) instanceof NamedList) {// extended results detected@SuppressWarnings("unchecked")- List<NamedList> extended = (List<NamedList>)list;+ List<NamedList<?>> extended = (List<NamedList<?>>)list;alternativeFrequencies = new ArrayList<>();- for (NamedList nl : extended) {+ for (NamedList<?> nl : extended) {alternatives.add((String)nl.get("word"));alternativeFrequencies.add((Integer)nl.get("freq"));}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SuggesterResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SuggesterResponse.javaindex 0dcb28b03c1..52e59b155cc 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SuggesterResponse.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SuggesterResponse.java@@ -35,19 +35,17 @@ public class SuggesterResponse {private final Map<String, List<Suggestion>> suggestionsPerDictionary = new LinkedHashMap<>();- @SuppressWarnings({"unchecked", "rawtypes"})public SuggesterResponse(NamedList<NamedList<Object>> suggestInfo) {for (int i = 0 ; i < suggestInfo.size(); i++) {final String outerName = suggestInfo.getName(i);final NamedList<Object> outerValue = suggestInfo.getVal(i);- SimpleOrderedMap suggestionsNode = (SimpleOrderedMap) outerValue.getVal(0);- List<SimpleOrderedMap> suggestionListToParse;+ SimpleOrderedMap<?> suggestionsNode = (SimpleOrderedMap<?>) outerValue.getVal(0);List<Suggestion> suggestionList = new LinkedList<>();if (suggestionsNode != null) {-- suggestionListToParse = (List<SimpleOrderedMap>) suggestionsNode.get(SUGGESTIONS_NODE_NAME);- for (SimpleOrderedMap suggestion : suggestionListToParse) {+ @SuppressWarnings("unchecked")+ List<SimpleOrderedMap<?>> suggestionListToParse = (List<SimpleOrderedMap<?>>) suggestionsNode.get(SUGGESTIONS_NODE_NAME);+ for (SimpleOrderedMap<?> suggestion : suggestionListToParse) {String term = (String) suggestion.get(TERM_NODE_NAME);long weight = (long) suggestion.get(WEIGHT_NODE_NAME);String payload = (String) suggestion.get(PAYLOAD_NODE_NAME);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketBasedJsonFacet.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketBasedJsonFacet.javaindex 1c0d707f840..9f08b7d897e 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketBasedJsonFacet.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketBasedJsonFacet.java@@ -49,15 +49,15 @@ public class BucketBasedJsonFacet {private long afterLastBucketCount = UNSET_FLAG;private long betweenAllBucketsCount = UNSET_FLAG;- @SuppressWarnings({"unchecked", "rawtypes"})- public BucketBasedJsonFacet(NamedList<Object> bucketBasedFacet) {- for (Map.Entry<String, Object> entry : bucketBasedFacet) {+ public BucketBasedJsonFacet(NamedList<?> bucketBasedFacet) {+ for (Map.Entry<String, ?> entry : bucketBasedFacet) {final String key = entry.getKey();final Object value = entry.getValue();if ("buckets".equals(key)) {- final List<NamedList> bucketListUnparsed = (List<NamedList>) value;+ @SuppressWarnings({"unchecked"})+ final List<NamedList<?>> bucketListUnparsed = (List<NamedList<?>>) value;buckets = new ArrayList<>();- for (NamedList bucket : bucketListUnparsed) {+ for (NamedList<?> bucket : bucketListUnparsed) {buckets.add(new BucketJsonFacet(bucket));}} else if ("numBuckets".equals(key)) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketJsonFacet.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketJsonFacet.javaindex 1786f265a7f..fb664f0e83d 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketJsonFacet.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/BucketJsonFacet.java@@ -39,7 +39,7 @@ import org.apache.solr.common.util.NamedList;public class BucketJsonFacet extends NestableJsonFacet {private Object val;- public BucketJsonFacet(NamedList<Object> singleBucket) {+ public BucketJsonFacet(NamedList<?> singleBucket) {super(singleBucket); // sets "count", and stats or nested facetsval = singleBucket.get("val");diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/HeatmapJsonFacet.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/HeatmapJsonFacet.javaindex da22f72f5f3..0b5ccbbe22c 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/HeatmapJsonFacet.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/HeatmapJsonFacet.java@@ -45,7 +45,7 @@ public class HeatmapJsonFacet {private String countEncodedAsBase64PNG;@SuppressWarnings({"unchecked"})- public HeatmapJsonFacet(NamedList<Object> heatmapNL) {+ public HeatmapJsonFacet(NamedList<?> heatmapNL) {gridLevel = (int) heatmapNL.get("gridLevel");columns = (int) heatmapNL.get("columns");rows = (int) heatmapNL.get("rows");@@ -95,7 +95,7 @@ public class HeatmapJsonFacet {* <p>* Heatmap facets do not support subfacets.*/- public static boolean isHeatmapFacet(NamedList<Object> potentialHeatmapValues) {+ public static boolean isHeatmapFacet(NamedList<?> potentialHeatmapValues) {boolean hasGridLevel = false;boolean hasColumns = false;boolean hasRows = false;@@ -104,7 +104,7 @@ public class HeatmapJsonFacet {boolean hasMinY = false;boolean hasMaxY = false;boolean hasCountGrid = false;- for (Map.Entry<String, Object> entry : potentialHeatmapValues) {+ for (Map.Entry<String, ?> entry : potentialHeatmapValues) {String key = entry.getKey();if ("gridLevel".equals(key)) {hasGridLevel = true;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/NestableJsonFacet.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/NestableJsonFacet.javaindex 8369fb8d083..78159f52fb5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/NestableJsonFacet.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/json/NestableJsonFacet.java@@ -39,13 +39,13 @@ public class NestableJsonFacet {private final Map<String, Object> statsByName;private final Map<String, HeatmapJsonFacet> heatmapFacetsByName;- public NestableJsonFacet(NamedList<Object> facetNL) {+ public NestableJsonFacet(NamedList<?> facetNL) {queryFacetsByName = new HashMap<>();bucketBasedFacetByName = new HashMap<>();heatmapFacetsByName = new HashMap<>();statsByName = new HashMap<>();- for (Map.Entry<String, Object> entry : facetNL) {+ for (Map.Entry<String, ?> entry : facetNL) {final String key = entry.getKey();if (getKeysToSkip().contains(key)) {continue;@@ -56,8 +56,7 @@ public class NestableJsonFacet {// Stat/agg facet valuestatsByName.put(key, entry.getValue());} else if(entry.getValue() instanceof NamedList) { // Either heatmap/query/range/terms facet- @SuppressWarnings({"unchecked"})- final NamedList<Object> facet = (NamedList<Object>) entry.getValue();+ final NamedList<?> facet = (NamedList<?>) entry.getValue();final boolean isBucketBased = facet.get("buckets") != null;final boolean isHeatmap = HeatmapJsonFacet.isHeatmapFacet(facet);if (isBucketBased) {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/AffinityReplicaListTransformer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/AffinityReplicaListTransformer.javaindex f6dbf610180..9b10bf64e0f 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/AffinityReplicaListTransformer.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/AffinityReplicaListTransformer.java@@ -16,7 +16,7 @@*/package org.apache.solr.client.solrj.routing;-import java.util.Arrays;+import java.util.ArrayList;import java.util.Comparator;import java.util.List;import java.util.ListIterator;@@ -63,32 +63,31 @@ public class AffinityReplicaListTransformer implements ReplicaListTransformer {}@Override- @SuppressWarnings({"unchecked", "rawtypes"})- public void transform(List<?> choices) {+ public <T> void transform(List<T> choices) {int size = choices.size();if (size > 1) {int i = 0;- SortableChoice[] sortableChoices = new SortableChoice[size];- for (Object o : choices) {- sortableChoices[i++] = new SortableChoice(o);+ ArrayList<SortableChoice<T>> sortableChoices = new ArrayList<>(choices.size());+ for (T choice : choices) {+ sortableChoices.add(new SortableChoice<>(choice));}- Arrays.sort(sortableChoices, SORTABLE_CHOICE_COMPARATOR);- ListIterator iter = choices.listIterator();+ sortableChoices.sort(SORTABLE_CHOICE_COMPARATOR);+ ListIterator<T> iter = choices.listIterator();i = routingDividend % size;final int limit = i + size;do {iter.next();- iter.set(sortableChoices[i % size].choice);+ iter.set(sortableChoices.get(i % size).choice);} while (++i < limit);}}- private static final class SortableChoice {+ private static final class SortableChoice<T> {- private final Object choice;+ private final T choice;private final String sortableCoreLabel;- private SortableChoice(Object choice) {+ private SortableChoice(T choice) {this.choice = choice;if (choice instanceof Replica) {this.sortableCoreLabel = ((Replica)choice).getCoreUrl();@@ -101,5 +100,5 @@ public class AffinityReplicaListTransformer implements ReplicaListTransformer {}- private static final Comparator<SortableChoice> SORTABLE_CHOICE_COMPARATOR = Comparator.comparing(o -> o.sortableCoreLabel);+ private static final Comparator<SortableChoice<?>> SORTABLE_CHOICE_COMPARATOR = Comparator.comparing(o -> o.sortableCoreLabel);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.javaindex bb8cecb7da5..7bbc7423250 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java@@ -83,7 +83,12 @@ public class NodePreferenceRulesComparator implements Comparator<Object> {}}}- private static final ReplicaListTransformer NOOP_RLT = (List<?> choices) -> { /* noop */ };+ private static final ReplicaListTransformer NOOP_RLT = new ReplicaListTransformer() {+ @Override+ public <T> void transform(List<T> choices) {+ // Cannot use a method reference because of generic types!+ }+ };private static final ReplicaListTransformerFactory NOOP_RLTF =(String configSpec, SolrParams requestParams, ReplicaListTransformerFactory fallback) -> NOOP_RLT;/**diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ReplicaListTransformer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ReplicaListTransformer.javaindex e2344c62fe8..4aef23aaa31 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ReplicaListTransformer.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ReplicaListTransformer.java@@ -21,6 +21,7 @@ import java.util.List;import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.params.ShardParams;+@FunctionalInterfacepublic interface ReplicaListTransformer {/**@@ -30,6 +31,6 @@ public interface ReplicaListTransformer {* @param choices - a list of choices to transform, typically the choices are {@link Replica} objects but choices* can also be {@link String} objects such as URLs passed in via the {@link ShardParams#SHARDS} parameter.*/- public void transform(List<?> choices);+ public <T> void transform(List<T> choices);}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.javaindex 12883722a1f..acf55463636 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java@@ -122,7 +122,7 @@ public class RequestReplicaListTransformerGenerator {}@Override- public void transform(List<?> choices) {+ public <T> void transform(List<T> choices) {if (choices.size() > 1) {if (log.isDebugEnabled()) {log.debug("Applying the following sorting preferences to replicas: {}",diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ShufflingReplicaListTransformer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ShufflingReplicaListTransformer.javaindex 7c37129c342..5084c29aece 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ShufflingReplicaListTransformer.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/ShufflingReplicaListTransformer.java@@ -29,7 +29,7 @@ public class ShufflingReplicaListTransformer implements ReplicaListTransformer {this.r = r;}- public void transform(List<?> choices)+ public <T> void transform(List<T> choices){if (choices.size() > 1) {Collections.shuffle(choices, r);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.javaindex 887b264306c..9afe1bd2747 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java@@ -82,8 +82,7 @@ public class ClientUtilsupdate = entry.getKey().toString();v = entry.getValue();if (v instanceof Collection) {- @SuppressWarnings({"rawtypes"})- Collection values = (Collection) v;+ Collection<?> values = (Collection<?>) v;for (Object value : values) {writeVal(writer, name, value, update);}diff --git a/solr/solrj/src/java/org/apache/solr/common/IteratorWriter.java b/solr/solrj/src/java/org/apache/solr/common/IteratorWriter.javaindex 143506d9a70..3e045864b5d 100644--- a/solr/solrj/src/java/org/apache/solr/common/IteratorWriter.java+++ b/solr/solrj/src/java/org/apache/solr/common/IteratorWriter.java@@ -74,8 +74,7 @@ public interface IteratorWriter {return this;}}- @SuppressWarnings({"unchecked", "rawtypes"})- default List toList( List l) {+ default List<Object> toList(List<Object> l) {try {writeIter(new ItemWriter() {@Overridediff --git a/solr/solrj/src/java/org/apache/solr/common/LazySolrCluster.java b/solr/solrj/src/java/org/apache/solr/common/LazySolrCluster.javaindex f339485b854..1107f9a39fa 100644--- a/solr/solrj/src/java/org/apache/solr/common/LazySolrCluster.java+++ b/solr/solrj/src/java/org/apache/solr/common/LazySolrCluster.java@@ -240,14 +240,13 @@ public class LazySolrCluster implements SolrCluster {}@Override- @SuppressWarnings("rawtypes")public String config() {if (confName == null) {// do this lazily . It's usually not necessarytry {byte[] d = zkStateReader.getZkClient().getData(getCollectionPathRoot(coll.getName()), null, null, true);if (d == null || d.length == 0) return null;- Map m = (Map) Utils.fromJSON(d);+ Map<?,?> m = (Map<?,?>) Utils.fromJSON(d);confName = (String) m.get("configName");} catch (KeeperException | InterruptedException e) {SimpleZkMap.throwZkExp(e);diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java b/solr/solrj/src/java/org/apache/solr/common/SolrDocument.javaindex 77c28a51de8..cd860c2435f 100644--- a/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java+++ b/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java@@ -100,11 +100,10 @@ public class SolrDocument extends SolrDocumentBase<Object, SolrDocument> impleme* set multiple fields with the included contents. This will replace any existing* field with the given name*/- @SuppressWarnings({"unchecked", "rawtypes"})public void setField(String name, Object value){if( value instanceof Object[] ) {- value = new ArrayList(Arrays.asList( (Object[])value ));+ value = new ArrayList<>(Arrays.asList( (Object[])value ));}else if( value instanceof Collection ) {// nothing@@ -187,8 +186,7 @@ public class SolrDocument extends SolrDocumentBase<Object, SolrDocument> implemepublic Object getFirstValue(String name) {Object v = _fields.get( name );if (v == null || !(v instanceof Collection)) return v;- @SuppressWarnings({"rawtypes"})- Collection c = (Collection)v;+ Collection<?> c = (Collection<?>)v;if (c.size() > 0 ) {return c.iterator().next();}diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrDocumentBase.java b/solr/solrj/src/java/org/apache/solr/common/SolrDocumentBase.javaindex d309719febe..618cf8a9f0c 100644--- a/solr/solrj/src/java/org/apache/solr/common/SolrDocumentBase.java+++ b/solr/solrj/src/java/org/apache/solr/common/SolrDocumentBase.java@@ -48,8 +48,7 @@ public abstract class SolrDocumentBase<T, K> implements Map<String, T>, Serializ/*** Get a collection of values for a given field name*/- @SuppressWarnings({"rawtypes"})- public abstract Collection getFieldValues(String name);+ public abstract Collection<Object> getFieldValues(String name);public abstract void addChildDocument(K child);diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java b/solr/solrj/src/java/org/apache/solr/common/SolrInputField.javaindex f823ade770b..b88212fe461 100644--- a/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java+++ b/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java@@ -108,8 +108,7 @@ public class SolrInputField implements Iterable<Object>, Serializablepublic Object getFirstValue() {if (value instanceof Collection) {- @SuppressWarnings({"unchecked"})- Collection<Object> c = (Collection<Object>) value;+ Collection<?> c = (Collection<?>) value;if (c.size() > 0) {return c.iterator().next();}diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/ImplicitSnitch.java b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/ImplicitSnitch.javaindex afada51c6d6..633cf85dc12 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/ImplicitSnitch.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/ImplicitSnitch.java@@ -95,8 +95,7 @@ public class ImplicitSnitch extends Snitch {}private void fillRole(String solrNode, SnitchContext ctx, String key) throws KeeperException, InterruptedException {- @SuppressWarnings({"rawtypes"})- Map roles = (Map) ctx.retrieve(ZkStateReader.ROLES); // we don't want to hit the ZK for each node+ Map<?,?> roles = (Map<?,?>) ctx.retrieve(ZkStateReader.ROLES); // we don't want to hit the ZK for each node// so cache and reusetry {if (roles == null) roles = ctx.getZkJson(ZkStateReader.ROLES);@@ -107,14 +106,12 @@ public class ImplicitSnitch extends Snitch {}private void cacheRoles(String solrNode, SnitchContext ctx, String key,- @SuppressWarnings({"rawtypes"})Map roles) {+ Map<?,?> roles) {ctx.store(ZkStateReader.ROLES, roles);if (roles != null) {- for (Object o : roles.entrySet()) {- @SuppressWarnings({"rawtypes"})- Map.Entry e = (Map.Entry) o;+ for (Map.Entry<?,?> e : roles.entrySet()) {if (e.getValue() instanceof List) {- if (((List) e.getValue()).contains(solrNode)) {+ if (((List<?>) e.getValue()).contains(solrNode)) {ctx.getTags().put(key, e.getKey());break;}diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/Snitch.java b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/Snitch.javaindex b429ebdf1e4..a495ed25f29 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/Snitch.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/Snitch.java@@ -19,12 +19,8 @@ package org.apache.solr.common.cloud.rule;import java.util.Collections;import java.util.Set;-/**- *- */public abstract class Snitch {- @SuppressWarnings({"rawtypes"})- public static final Set<Class> WELL_KNOWN_SNITCHES = Collections.singleton(ImplicitSnitch.class);+ public static final Set<Class<?>> WELL_KNOWN_SNITCHES = Collections.singleton(ImplicitSnitch.class);public abstract void getTags(String solrNode, Set<String> requestedTags, SnitchContext ctx);diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/SnitchContext.java b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/SnitchContext.javaindex 2720fb956d5..7e46b94eee2 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/rule/SnitchContext.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/rule/SnitchContext.java@@ -64,8 +64,7 @@ public abstract class SnitchContext implements RemoteCallback {return Collections.emptyMap();}- @SuppressWarnings({"rawtypes"})- public abstract Map getZkJson(String path) throws KeeperException, InterruptedException;+ public abstract Map<?,?> getZkJson(String path) throws KeeperException, InterruptedException;public String getNode() {return node;diff --git a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.javaindex c729534ba40..bea47567d00 100644--- a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java+++ b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java@@ -458,7 +458,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma/** Create a Map<String,String> from a NamedList given no keys are repeated */@Deprecated // Doesn't belong here (no SolrParams). Just remove.- public static Map<String,String> toMap(@SuppressWarnings({"rawtypes"})NamedList params) {+ public static Map<String,String> toMap(NamedList<?> params) {HashMap<String,String> map = new HashMap<>();for (int i=0; i<params.size(); i++) {map.put(params.getName(i), params.getVal(i).toString());@@ -468,7 +468,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma/** Create a Map<String,String[]> from a NamedList */@Deprecated // Doesn't belong here (no SolrParams). Just remove.- public static Map<String,String[]> toMultiMap(@SuppressWarnings({"rawtypes"})NamedList params) {+ public static Map<String,String[]> toMultiMap(NamedList<?> params) {HashMap<String,String[]> map = new HashMap<>();for (int i=0; i<params.size(); i++) {String name = params.getName(i);@@ -476,8 +476,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Maif (val instanceof String[]) {MultiMapSolrParams.addParam(name, (String[]) val, map);} else if (val instanceof List) {- @SuppressWarnings({"rawtypes"})- List l = (List) val;+ List<?> l = (List<?>) val;String[] s = new String[l.size()];for (int j = 0; j < l.size(); j++) {s[j] = l.get(j) == null ? null : String.valueOf(l.get(j));@@ -495,7 +494,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma* @deprecated Use {@link NamedList#toSolrParams()}.*/@Deprecated //move to NamedList to allow easier flow- public static SolrParams toSolrParams(@SuppressWarnings({"rawtypes"})NamedList params) {+ public static SolrParams toSolrParams(NamedList<?> params) {return params.toSolrParams();}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java b/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.javaindex 0a65b0d62f2..2088e2b5828 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/ByteArrayUtf8CharSequence.java@@ -180,18 +180,18 @@ public class ByteArrayUtf8CharSequence implements Utf8CharSequence {return new ByteArrayUtf8CharSequence(bytes, 0, length, utf16, hashCode);}- @SuppressWarnings({"unchecked", "rawtypes"})+ @SuppressWarnings({"rawtypes"})public static Map.Entry convertCharSeq(Map.Entry e) {if (e.getKey() instanceof Utf8CharSequence || e.getValue() instanceof Utf8CharSequence) {- return new AbstractMap.SimpleEntry(convertCharSeq(e.getKey()), convertCharSeq(e.getValue()));+ return new AbstractMap.SimpleEntry<>(convertCharSeq(e.getKey()), convertCharSeq(e.getValue()));}return e;}- @SuppressWarnings({"unchecked", "rawtypes"})- public static Collection convertCharSeq(Collection vals) {- if (vals == null) return vals;+ @SuppressWarnings("rawtypes")+ public static Collection convertCharSeq(Collection<?> vals) {+ if (vals == null) return null;boolean needsCopy = false;for (Object o : vals) {if (o instanceof Utf8CharSequence) {@@ -200,7 +200,7 @@ public class ByteArrayUtf8CharSequence implements Utf8CharSequence {}}if (needsCopy) {- Collection copy = null;+ Collection<Object> copy = null;if (vals instanceof Set){copy = new HashSet<>(vals.size());} else {@@ -215,7 +215,7 @@ public class ByteArrayUtf8CharSequence implements Utf8CharSequence {public static Object convertCharSeq(Object o) {if (o == null) return null;if (o instanceof Utf8CharSequence) return ((Utf8CharSequence) o).toString();- if (o instanceof Collection) return convertCharSeq((Collection) o);+ if (o instanceof Collection) return convertCharSeq((Collection<?>) o);return o;}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java b/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.javaindex 58205b5819e..6c89540104b 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java@@ -100,8 +100,7 @@ public class CommandOperation {return commandData;}if (commandData instanceof Map) {- @SuppressWarnings({"rawtypes"})- Map metaData = (Map) commandData;+ Map<?,?> metaData = (Map<?,?>) commandData;return metaData.get(key);} else {String msg = " value has to be an object for operation :" + name;@@ -227,16 +226,15 @@ public class CommandOperation {* Parse the command operations into command objects from javabin payload* * @param singletonCommands commands that cannot be repeated*/- @SuppressWarnings({"unchecked", "rawtypes"})public static List<CommandOperation> parse(InputStream in, Set<String> singletonCommands) throws IOException {List<CommandOperation> operations = new ArrayList<>();- final HashMap map = new HashMap(0) {+ final HashMap<Object,Object> map = new HashMap<>(0) {@Overridepublic Object put(Object key, Object value) {- List vals = null;+ List<?> vals = null;if (value instanceof List && !singletonCommands.contains(key)) {- vals = (List) value;+ vals = (List<?>) value;} else {vals = Collections.singletonList(value);}@@ -290,8 +288,7 @@ public class CommandOperation {ev = parser.nextEvent();Object val = ob.getVal();if (val instanceof List && !singletonCommands.contains(key)) {- @SuppressWarnings({"rawtypes"})- List list = (List) val;+ List<?> list = (List<?>) val;for (Object o : list) {if (!(o instanceof Map)) {operations.add(new CommandOperation(String.valueOf(key), list));diff --git a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.javaindex d0b1f7b94e9..5fd010750b4 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java@@ -131,8 +131,7 @@ public class DOMUtil {return nodesToNamedList(nd.getChildNodes());}- @SuppressWarnings({"rawtypes"})- public static List childNodesToList(Node nd) {+ public static List<Object> childNodesToList(Node nd) {return nodesToList(nd.getChildNodes());}@@ -148,9 +147,8 @@ public class DOMUtil {return clst;}- @SuppressWarnings({"rawtypes"})- public static List nodesToList(NodeList nlst) {- List lst = new ArrayList();+ public static List<Object> nodesToList(NodeList nlst) {+ List<Object> lst = new ArrayList<>();for (int i=0; i<nlst.getLength(); i++) {addToNamedList(nlst.item(i), null, lst);}@@ -170,10 +168,9 @@ public class DOMUtil {* @param arr A List to add the item to.* If this param is null it will be ignored.*/- @SuppressWarnings("unchecked")public static void addToNamedList(Node nd,- @SuppressWarnings({"rawtypes"})NamedList nlst,- @SuppressWarnings({"rawtypes"})List arr) {+ NamedList<Object> nlst,+ List<Object> arr) {// Nodes often include whitespace, etc... so just return if this// is not an Element.if (nd.getNodeType() != Node.ELEMENT_NODE) return;diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.javaindex cb23d94250a..f2d874f866d 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java@@ -198,12 +198,10 @@ public class ExecutorUtil {final String submitterContextStr = ctxStr.length() <= MAX_THREAD_NAME_LEN ? ctxStr : ctxStr.substring(0, MAX_THREAD_NAME_LEN);final Exception submitterStackTrace = enableSubmitterStackTrace ? new Exception("Submitter stack trace") : null;final List<InheritableThreadLocalProvider> providersCopy = providers;- @SuppressWarnings({"rawtypes"})- final ArrayList<AtomicReference> ctx = providersCopy.isEmpty() ? null : new ArrayList<>(providersCopy.size());+ final ArrayList<AtomicReference<?>> ctx = providersCopy.isEmpty() ? null : new ArrayList<>(providersCopy.size());if (ctx != null) {for (int i = 0; i < providers.size(); i++) {- @SuppressWarnings({"rawtypes"})- AtomicReference reference = new AtomicReference();+ AtomicReference<?> reference = new AtomicReference<>();ctx.add(reference);providersCopy.get(i).store(reference);}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.javaindex fb45e883fe3..649ea682f32 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java@@ -753,7 +753,7 @@ public class JavaBinCodec implements PushWriter {val.writeIter(itemWriter);writeTag(END);}- public void writeIterator(@SuppressWarnings({"rawtypes"})Iterator iter) throws IOException {+ public void writeIterator(Iterator<?> iter) throws IOException {writeTag(ITERATOR);while (iter.hasNext()) {writeVal(iter.next());@@ -771,14 +771,14 @@ public class JavaBinCodec implements PushWriter {return l;}- public void writeArray(@SuppressWarnings({"rawtypes"})List l) throws IOException {+ public void writeArray(List<?> l) throws IOException {writeTag(ARR, l.size());for (int i = 0; i < l.size(); i++) {writeVal(l.get(i));}}- public void writeArray(@SuppressWarnings({"rawtypes"})Collection coll) throws IOException {+ public void writeArray(Collection<?> coll) throws IOException {writeTag(ARR, coll.size());for (Object o : coll) {writeVal(o);diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.javaindex d44dea173ec..b5877d0a07b 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java@@ -343,7 +343,6 @@ public class JsonRecordReader {}@Override- @SuppressWarnings({"unchecked"})public void walk(int event) throws IOException {if (event == OBJECT_START) {walkObject();@@ -354,8 +353,7 @@ public class JsonRecordReader {// ensure that the value is of type Listfinal Object val = values.get(name);if (val != null && !(val instanceof List)) {- @SuppressWarnings({"rawtypes"})- final ArrayList listVal = new ArrayList(1);+ final ArrayList<Object> listVal = new ArrayList<>(1);listVal.add(val);values.put(name, listVal);}@@ -458,8 +456,7 @@ public class JsonRecordReader {} else if (oldVal instanceof List) {((List) oldVal).add(record);} else {- @SuppressWarnings({"rawtypes"})- ArrayList l = new ArrayList();+ ArrayList<Object> l = new ArrayList<>();l.add(oldVal);l.add(record);values.put(key, l);@@ -481,7 +478,6 @@ public class JsonRecordReader {}- @SuppressWarnings({"unchecked"})private void putValue(Map<String, Object> values, String fieldName, Object o) {if (o == null) return;Object val = values.get(fieldName);@@ -490,13 +486,12 @@ public class JsonRecordReader {return;}if (val instanceof List) {- @SuppressWarnings({"rawtypes"})- List list = (List) val;+ @SuppressWarnings({"unchecked"})+ List<Object> list = (List<Object>) val;list.add(o);return;}- @SuppressWarnings({"rawtypes"})- ArrayList l = new ArrayList();+ ArrayList<Object> l = new ArrayList<>();l.add(val);l.add(o);values.put(fieldName, l);@@ -610,12 +605,10 @@ public class JsonRecordReader {public abstract void walk(int event) throws IOException;}- @SuppressWarnings({"unchecked"})public static List<Object> parseArrayFieldValue(int ev, JSONParser parser, MethodFrameWrapper runnable) throws IOException {assert ev == ARRAY_START;- @SuppressWarnings({"rawtypes"})- ArrayList lst = new ArrayList(2);+ ArrayList<Object> lst = new ArrayList<>(2);for (; ; ) {ev = parser.nextEvent();if (ev == ARRAY_END) {diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.javaindex e246d02a9f1..96cd376394f 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java@@ -26,10 +26,9 @@ import java.util.function.Function;* It validates most aspects of json schema but it is NOT A FULLY COMPLIANT JSON schema parser or validator.* This validator borrow some design's idea from https://github.com/networknt/json-schema-validator*/-@SuppressWarnings({"unchecked", "rawtypes"})public class JsonSchemaValidator {- private List<Validator> validators;+ private List<Validator<?>> validators;private static Set<String> KNOWN_FNAMES = new HashSet<>(Arrays.asList("description","documentation","default","additionalProperties"));@@ -44,22 +43,28 @@ public class JsonSchemaValidator {Object fname = entry.getKey();if (KNOWN_FNAMES.contains(fname.toString())) continue;- Function<Pair<Map, Object>, Validator> initializeFunction = VALIDATORS.get(fname.toString());+ Function<Pair<Map<?,?>, ?>, Validator<?>> initializeFunction = VALIDATORS.get(fname.toString());if (initializeFunction == null) throw new RuntimeException("Unknown key : " + fname);this.validators.add(initializeFunction.apply(new Pair<>(jsonSchema, entry.getValue())));}}- static final Map<String, Function<Pair<Map,Object>, Validator>> VALIDATORS = new HashMap<>();+ // This is a heterogeneous type, there's probably imrpovements to be had by using some concrete types instead+ static final Map<String, Function<Pair<Map<?,?>, ?>, Validator<?>>> VALIDATORS = new HashMap<>();static {- VALIDATORS.put("items", pair -> new ItemsValidator(pair.first(), (Map) pair.second()));- VALIDATORS.put("enum", pair -> new EnumValidator(pair.first(), (List) pair.second()));- VALIDATORS.put("properties", pair -> new PropertiesValidator(pair.first(), (Map) pair.second()));+ loadValidators();+ }++ @SuppressWarnings("unchecked")+ private static void loadValidators() {+ VALIDATORS.put("items", pair -> new ItemsValidator(pair.first(), (Map<?,?>) pair.second()));+ VALIDATORS.put("enum", pair -> new EnumValidator(pair.first(), (List<String>) pair.second()));+ VALIDATORS.put("properties", pair -> new PropertiesValidator(pair.first(), (Map<String,Map<?,?>>) pair.second()));VALIDATORS.put("type", pair -> new TypeValidator(pair.first(), pair.second()));- VALIDATORS.put("required", pair -> new RequiredValidator(pair.first(), (List)pair.second()));- VALIDATORS.put("oneOf", pair -> new OneOfValidator(pair.first(), (List)pair.second()));+ VALIDATORS.put("required", pair -> new RequiredValidator(pair.first(), (List<String>) pair.second()));+ VALIDATORS.put("oneOf", pair -> new OneOfValidator(pair.first(), (List<String>) pair.second()));}public List<String> validateJson(Object data) {@@ -70,7 +75,7 @@ public class JsonSchemaValidator {boolean validate(Object data, List<String> errs) {if (data == null) return true;- for (Validator validator : validators) {+ for (Validator<?> validator : validators) {if (!validator.validate(data, errs)) {return false;}@@ -81,7 +86,7 @@ public class JsonSchemaValidator {}abstract class Validator<T> {- Validator(@SuppressWarnings({"rawtypes"})Map schema, T properties) {};+ Validator(Map<?,?> schema, T properties) {};abstract boolean validate(Object o, List<String> errs);}@@ -135,7 +140,7 @@ enum Type {class TypeValidator extends Validator<Object> {private Set<Type> types;- TypeValidator(@SuppressWarnings({"rawtypes"})Map schema, Object type) {+ TypeValidator(Map<?,?> schema, Object type) {super(schema, type);types = new HashSet<>(1);if (type instanceof List) {@@ -165,10 +170,9 @@ class TypeValidator extends Validator<Object> {}}-@SuppressWarnings({"rawtypes"})-class ItemsValidator extends Validator<Map> {+class ItemsValidator extends Validator<Map<?,?>> {private JsonSchemaValidator validator;- ItemsValidator(Map schema, Map properties) {+ ItemsValidator(Map<?,?> schema, Map<?,?> properties) {super(schema, properties);validator = new JsonSchemaValidator(properties);}@@ -192,7 +196,7 @@ class EnumValidator extends Validator<List<String>> {private Set<String> enumVals;- EnumValidator(@SuppressWarnings({"rawtypes"})Map schema, List<String> properties) {+ EnumValidator(Map<?,?> schema, List<String> properties) {super(schema, properties);enumVals = new HashSet<>(properties);@@ -215,7 +219,7 @@ class RequiredValidator extends Validator<List<String>> {private Set<String> requiredProps;- RequiredValidator(@SuppressWarnings({"rawtypes"})Map schema, List<String> requiredProps) {+ RequiredValidator(Map<?,?> schema, List<String> requiredProps) {super(schema, requiredProps);this.requiredProps = new HashSet<>(requiredProps);}@@ -227,8 +231,7 @@ class RequiredValidator extends Validator<List<String>> {boolean validate( Object o, List<String> errs, Set<String> requiredProps) {if (o instanceof Map) {- @SuppressWarnings({"rawtypes"})- Set fnames = ((Map) o).keySet();+ Set<?> fnames = ((Map<?,?>) o).keySet();for (String requiredProp : requiredProps) {if (requiredProp.contains(".")) {if (requiredProp.endsWith(".")) {@@ -252,17 +255,16 @@ class RequiredValidator extends Validator<List<String>> {}}-@SuppressWarnings({"rawtypes"})-class PropertiesValidator extends Validator<Map<String, Map>> {+class PropertiesValidator extends Validator<Map<String, Map<?,?>>> {private Map<String, JsonSchemaValidator> jsonSchemas;private boolean additionalProperties;- @SuppressWarnings({"unchecked", "rawtypes"})- PropertiesValidator(Map schema, Map<String, Map> properties) {+ PropertiesValidator(Map<?,?> schema, Map<String, Map<?,?>> properties) {super(schema, properties);jsonSchemas = new HashMap<>();- this.additionalProperties = (boolean) schema.getOrDefault("additionalProperties", false);- for (Map.Entry<String, Map> entry : properties.entrySet()) {+ Object additionalProperties = schema.get("additionalProperties"); // If not set, will return null+ this.additionalProperties = Boolean.TRUE.equals(additionalProperties) ? true : false; // Implicit null -> false+ for (Map.Entry<String, Map<?,?>> entry : properties.entrySet()) {jsonSchemas.put(entry.getKey(), new JsonSchemaValidator(entry.getValue()));}}@@ -292,7 +294,7 @@ class OneOfValidator extends Validator<List<String>> {private Set<String> oneOfProps;- OneOfValidator(@SuppressWarnings({"rawtypes"})Map schema, List<String> oneOfProps) {+ OneOfValidator(Map<?,?> schema, List<String> oneOfProps) {super(schema, oneOfProps);this.oneOfProps = new HashSet<>(oneOfProps);}@@ -300,8 +302,7 @@ class OneOfValidator extends Validator<List<String>> {@Overrideboolean validate(Object o, List<String> errs) {if (o instanceof Map) {- @SuppressWarnings({"rawtypes"})- Map map = (Map) o;+ Map<?,?> map = (Map<?,?>) o;for (Object key : map.keySet()) {if (oneOfProps.contains(key.toString())) return true;}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.javaindex ec472ad79eb..42025e38786 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java@@ -22,7 +22,6 @@ import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;-import java.util.Set;import org.apache.solr.common.IteratorWriter;import org.apache.solr.common.MapWriter;@@ -186,7 +185,7 @@ public interface JsonTextWriter extends TextWriter {_writeChar(':');}- default void writeJsonIter(@SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ default void writeJsonIter(Iterator<?> val) throws IOException {incLevel();boolean first = true;while (val.hasNext()) {@@ -233,8 +232,7 @@ public interface JsonTextWriter extends TextWriter {}- @SuppressWarnings({"unchecked", "rawtypes"})- default void writeMap(String name, Map val, boolean excludeOuter, boolean isFirstVal) throws IOException {+ default void writeMap(String name, Map<?, ?> val, boolean excludeOuter, boolean isFirstVal) throws IOException {if (!excludeOuter) {writeMapOpener(val.size());incLevel();@@ -243,7 +241,7 @@ public interface JsonTextWriter extends TextWriter {boolean doIndent = excludeOuter || val.size() > 1;- for (Map.Entry entry : (Set<Map.Entry>) val.entrySet()) {+ for (Map.Entry<?,?> entry : val.entrySet()) {Object e = entry.getKey();String k = e == null ? "" : e.toString();Object v = entry.getValue();@@ -266,13 +264,13 @@ public interface JsonTextWriter extends TextWriter {}- default void writeArray(String name, @SuppressWarnings({"rawtypes"})List l) throws IOException {+ default void writeArray(String name, List<?> l) throws IOException {writeArrayOpener(l.size());writeJsonIter(l.iterator());writeArrayCloser();}- default void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException {+ default void writeArray(String name, Iterator<?> val) throws IOException {writeArrayOpener(-1); // no trivial way to determine array sizewriteJsonIter(val);writeArrayCloser();@@ -287,7 +285,7 @@ public interface JsonTextWriter extends TextWriter {out.append(hexdigits[(ch) & 0xf]);}- default void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedList(String name, NamedList<?> val) throws IOException {String namedListStyle = getNamedListStyle();if (val instanceof SimpleOrderedMap) {writeNamedListAsMapWithDups(name, val);@@ -310,7 +308,7 @@ public interface JsonTextWriter extends TextWriter {* Map null to "" and name mangle any repeated keys to avoid repeats in the* output.*/- default void writeNamedListAsMapMangled(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedListAsMapMangled(String name, NamedList<?> val) throws IOException {int sz = val.size();writeMapOpener(sz);incLevel();@@ -370,7 +368,7 @@ public interface JsonTextWriter extends TextWriter {* null key is mapped to "".*/// NamedList("a"=1,"bar"="foo",null=3,null=null) => {"a":1,"bar":"foo","":3,"":null}- default void writeNamedListAsMapWithDups(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedListAsMapWithDups(String name, NamedList<?> val) throws IOException {int sz = val.size();writeMapOpener(sz);incLevel();@@ -393,7 +391,7 @@ public interface JsonTextWriter extends TextWriter {// Represents a NamedList directly as an array of JSON objects...// NamedList("a"=1,"b"=2,null=3,null=null) => [{"a":1},{"b":2},3,null]- default void writeNamedListAsArrMap(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedListAsArrMap(String name, NamedList<?> val) throws IOException {int sz = val.size();indent();writeArrayOpener(sz);@@ -428,7 +426,7 @@ public interface JsonTextWriter extends TextWriter {// Represents a NamedList directly as an array of JSON objects...// NamedList("a"=1,"b"=2,null=3,null=null) => [["a",1],["b",2],[null,3],[null,null]]- default void writeNamedListAsArrArr(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedListAsArrArr(String name, NamedList<?> val) throws IOException {int sz = val.size();indent();writeArrayOpener(sz);@@ -472,7 +470,7 @@ public interface JsonTextWriter extends TextWriter {// Represents a NamedList directly as an array with keys/values// interleaved.// NamedList("a"=1,"b"=2,null=3,null=null) => ["a",1,"b",2,null,3,null,null]- default void writeNamedListAsFlat(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException {+ default void writeNamedListAsFlat(String name, NamedList<?> val) throws IOException {int sz = val.size();writeArrayOpener(sz * 2);incLevel();diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.javaindex e5ae8e23b20..12906125904 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java@@ -619,7 +619,8 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry}/** Appends the elements of the given NamedList to this one. */- public boolean addAll(NamedList<T> nl) {+ // TODO this seems scary because it does not type checking+ public boolean addAll(NamedList<? extends T> nl) {nvPairs.addAll(nl.nvPairs);return nl.size()>0;}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/TextWriter.java b/solr/solrj/src/java/org/apache/solr/common/util/TextWriter.javaindex f6b2c9e4cd3..85bd5b76052 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/TextWriter.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/TextWriter.java@@ -93,9 +93,9 @@ public interface TextWriter extends PushWriter {void writeStr(String name, String val, boolean needsEscaping) throws IOException;- void writeMap(String name, @SuppressWarnings({"rawtypes"})Map val, boolean excludeOuter, boolean isFirstVal) throws IOException;+ void writeMap(String name, Map<?, ?> val, boolean excludeOuter, boolean isFirstVal) throws IOException;- void writeArray(String name, @SuppressWarnings({"rawtypes"})Iterator val) throws IOException;+ void writeArray(String name, Iterator<?> val) throws IOException;void writeNull(String name) throws IOException;@@ -121,7 +121,7 @@ public interface TextWriter extends PushWriter {/** if this form of the method is called, val is the Solr ISO8601 based date format */void writeDate(String name, String val) throws IOException;- void writeNamedList(String name, @SuppressWarnings({"rawtypes"})NamedList val) throws IOException;+ void writeNamedList(String name, NamedList<?> val) throws IOException;Writer getWriter();@@ -154,7 +154,7 @@ public interface TextWriter extends PushWriter {writeArray(name, Arrays.asList(val));}- default void writeArray(String name, @SuppressWarnings({"rawtypes"})List l) throws IOException {+ default void writeArray(String name, List<?> l) throws IOException {writeArray(name, l.iterator());}diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java b/solr/solrj/src/java/org/apache/solr/common/util/Utils.javaindex b10d2585bbd..21392a0670e 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java@@ -89,8 +89,6 @@ import org.slf4j.MDC;import static java.nio.charset.StandardCharsets.UTF_8;import static java.util.Collections.singletonList;-import static java.util.Collections.unmodifiableList;-import static java.util.Collections.unmodifiableSet;import static java.util.concurrent.TimeUnit.NANOSECONDS;@@ -99,17 +97,17 @@ public class Utils {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());@SuppressWarnings({"rawtypes"})- public static Map getDeepCopy(Map map, int maxDepth) {+ public static Map getDeepCopy(Map<?,?> map, int maxDepth) {return getDeepCopy(map, maxDepth, true, false);}@SuppressWarnings({"rawtypes"})- public static Map getDeepCopy(Map map, int maxDepth, boolean mutable) {+ public static Map getDeepCopy(Map<?,?> map, int maxDepth, boolean mutable) {return getDeepCopy(map, maxDepth, mutable, false);}@SuppressWarnings({"unchecked", "rawtypes"})- public static Map getDeepCopy(Map map, int maxDepth, boolean mutable, boolean sorted) {+ public static Map getDeepCopy(Map<?,?> map, int maxDepth, boolean mutable, boolean sorted) {if (map == null) return null;if (maxDepth < 1) return map;Map copy;@@ -119,7 +117,7 @@ public class Utils {copy = map instanceof LinkedHashMap ? new LinkedHashMap<>(map.size()) : new HashMap<>(map.size());}for (Object o : map.entrySet()) {- Map.Entry e = (Map.Entry) o;+ Map.Entry<?,?> e = (Map.Entry<?,?>) o;copy.put(e.getKey(), makeDeepCopy(e.getValue(), maxDepth, mutable, sorted));}return mutable ? copy : Collections.unmodifiableMap(copy);@@ -155,21 +153,21 @@ public class Utils {}}- @SuppressWarnings({"unchecked", "rawtypes"})private static Object makeDeepCopy(Object v, int maxDepth, boolean mutable, boolean sorted) {if (v instanceof MapWriter && maxDepth > 1) {v = ((MapWriter) v).toMap(new LinkedHashMap<>());} else if (v instanceof IteratorWriter && maxDepth > 1) {- v = ((IteratorWriter) v).toList(new ArrayList<>());+ List<Object> l = ((IteratorWriter) v).toList(new ArrayList<>());if (sorted) {- Collections.sort((List) v);+ l.sort(null);}+ v = l;}if (v instanceof Map) {v = getDeepCopy((Map) v, maxDepth - 1, mutable, sorted);} else if (v instanceof Collection) {- v = getDeepCopy((Collection) v, maxDepth - 1, mutable, sorted);+ v = getDeepCopy((Collection<?>) v, maxDepth - 1, mutable, sorted);}return v;}@@ -188,21 +186,19 @@ public class Utils {}}- @SuppressWarnings({"rawtypes"})- public static Collection getDeepCopy(Collection c, int maxDepth, boolean mutable) {+ public static Collection<?> getDeepCopy(Collection<?> c, int maxDepth, boolean mutable) {return getDeepCopy(c, maxDepth, mutable, false);}- @SuppressWarnings({"unchecked", "rawtypes"})- public static Collection getDeepCopy(Collection c, int maxDepth, boolean mutable, boolean sorted) {+ public static Collection<?> getDeepCopy(Collection<?> c, int maxDepth, boolean mutable, boolean sorted) {if (c == null || maxDepth < 1) return c;- Collection result = c instanceof Set ?- (sorted ? new TreeSet() : new HashSet()) : new ArrayList();- for (Object o : c) result.add(makeDeepCopy(o, maxDepth, mutable, sorted));+ Collection<Object> result = c instanceof Set ?+ (sorted ? new TreeSet<>() : new HashSet<>()) : new ArrayList<>();+ for (Object o : c) result.add(makeDeepCopy(o, maxDepth, mutable, sorted)); // TODO should this be maxDepth - 1?if (sorted && (result instanceof List)) {- Collections.sort((List) result);+ ((List<Object>) result).sort(null);}- return mutable ? result : result instanceof Set ? unmodifiableSet((Set) result) : unmodifiableList((List) result);+ return mutable ? result : Collections.unmodifiableCollection(result);}public static void writeJson(Object o, OutputStream os, boolean indent) throws IOException {@@ -225,7 +221,6 @@ public class Utils {}@Override- @SuppressWarnings({"rawtypes"})public void handleUnknownClass(Object o) {// avoid materializing MapWriter / IteratorWriter to Map / List// instead serialize them directly@@ -447,7 +442,6 @@ public class Utils {return setObjectByPath(root, parts, value);}- @SuppressWarnings({"unchecked"})public static boolean setObjectByPath(Object root, List<String> hierarchy, Object value) {if (root == null) return false;if (!isMapLike(root)) throw new RuntimeException("must be a Map or NamedList");@@ -466,8 +460,7 @@ public class Utils {Object o = getVal(obj, s, -1);if (o == null) return false;if (idx > -1) {- @SuppressWarnings({"rawtypes"})- List l = (List) o;+ List<?> l = (List<?>) o;o = idx < l.size() ? l.get(idx) : null;}if (!isMapLike(o)) return false;@@ -475,20 +468,22 @@ public class Utils {} else {if (idx == -2) {if (obj instanceof NamedList) {- @SuppressWarnings({"rawtypes"})- NamedList namedList = (NamedList) obj;+ @SuppressWarnings("unchecked")+ NamedList<Object> namedList = (NamedList<Object>) obj;int location = namedList.indexOf(s, 0);if (location == -1) namedList.add(s, value);else namedList.setVal(location, value);} else if (obj instanceof Map) {- ((Map) obj).put(s, value);+ @SuppressWarnings("unchecked")+ Map<String, Object> map = ((Map<String, Object>) obj);+ map.put(s, value);}return true;} else {Object v = getVal(obj, s, -1);if (v instanceof List) {- @SuppressWarnings({"rawtypes"})- List list = (List) v;+ @SuppressWarnings("unchecked")+ List<Object> list = (List<Object>) v;if (idx == -1) {list.add(value);} else {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.javaindex ac43555550e..1eadc36b650 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java@@ -267,7 +267,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBaseassertTrue("echoed params are not a NamedList: " +response.getResponseHeader().get("params").getClass(),response.getResponseHeader().get("params") instanceof NamedList);- NamedList echo = (NamedList) response.getResponseHeader().get("params");+ NamedList<?> echo = (NamedList<?>) response.getResponseHeader().get("params");List values = null;assertEquals("foo", echo.get("q"));assertTrue("echoed fq is not a List: " + echo.get("fq").getClass(),@@ -603,8 +603,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBaseassertTrue( "should be bigger ["+id1+","+id2+"]", id2 > id1 );// The score from explain should be the same as the score- @SuppressWarnings({"rawtypes"})- NamedList explain = (NamedList)out1.getFieldValue( "[explain]" );+ NamedList<?> explain = (NamedList<?>)out1.getFieldValue( "[explain]" );assertEquals( out1.get( "score"), explain.get( "value" ) );// Augmented _value_ with alias@@ -789,7 +788,6 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase}@Test- @SuppressWarnings({"unchecked", "rawtypes"})public void testMultiContentWriterRequest() throws Exception {SolrClient client = getSolrClient();client.deleteByQuery("*:*");// delete everything!@@ -797,13 +795,13 @@ abstract public class SolrExampleTests extends SolrExampleTestsBaseQueryResponse rsp = client.query(new SolrQuery("*:*"));Assert.assertEquals(0, rsp.getResults().getNumFound());- List<Pair<NamedList, Object>> docs = new ArrayList<>();- NamedList params = new NamedList();- docs.add(new Pair(params, getFileContent(params, "solrj/docs1.xml")));+ List<Pair<NamedList<String>, Object>> docs = new ArrayList<>();+ NamedList<String> params = new NamedList<>();+ docs.add(new Pair<>(params, getFileContent(params, "solrj/docs1.xml")));- params = new NamedList();+ params = new NamedList<>();params.add(ASSUME_CONTENT_TYPE, "application/csv");- docs.add(new Pair(params, getFileContent(params, "solrj/books.csv")));+ docs.add(new Pair<>(params, getFileContent(params, "solrj/books.csv")));MultiContentWriterRequest up = new MultiContentWriterRequest(SolrRequest.METHOD.POST, "/update", docs.iterator());up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);@@ -814,7 +812,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase}- private ByteBuffer getFileContent(@SuppressWarnings({"rawtypes"})NamedList nl, String name) throws IOException {+ private ByteBuffer getFileContent(NamedList<?> nl, String name) throws IOException {try (InputStream is = new FileInputStream(getFile(name))) {return MultiContentWriterRequest.readByteBuffer(is);}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.javaindex bb41dd5ed5f..c6c5576ef5f 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java@@ -91,7 +91,6 @@ public class SolrSchemalessExampleTest extends SolrExampleTestsBase {}@Test- @SuppressWarnings({"unchecked"})public void testFieldMutating() throws Exception {HttpSolrClient client = (HttpSolrClient) getSolrClient();client.deleteByQuery("*:*");@@ -122,8 +121,7 @@ public class SolrSchemalessExampleTest extends SolrExampleTestsBase {"p_q","p.q","x_y");- @SuppressWarnings({"rawtypes"})- HashSet set = new HashSet();+ HashSet<String> set = new HashSet<>();QueryResponse rsp = assertNumFound("*:*", expected.size());for (SolrDocument doc : rsp.getResults()) set.addAll(doc.getFieldNames());for (String s : expected) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.javaindex 4832af99d6c..af7f5a4533a 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java@@ -558,8 +558,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {HttpSolrClient solrClient = getHttpSolrClient(jetty.getBaseUrl().toString() + "/collection1",client, null);QueryRequest req = new QueryRequest();- @SuppressWarnings({"rawtypes"})- NamedList response = solrClient.request(req);+ NamedList<?> response = solrClient.request(req);InputStream stream = (InputStream) response.get("stream");assertNotNull(stream);stream.close();@@ -676,7 +675,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {}private void verifyServletState(HttpSolrClient client,- @SuppressWarnings({"rawtypes"})SolrRequest request) {+ SolrRequest<?> request) {// check query StringIterator<String> paramNames = request.getParams().getParameterNamesIterator();while (paramNames.hasNext()) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.javaindex 1c9196c13af..679930e3cf2 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java@@ -21,14 +21,11 @@ import java.util.ArrayList;import java.util.List;import com.google.common.collect.Lists;-import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.cloud.SolrCloudTestCase;import org.junit.BeforeClass;import org.junit.Test;-import static org.hamcrest.core.StringContains.containsString;-public class CloudHttp2SolrClientBadInputTest extends SolrCloudTestCase {private static final List<String> NULL_STR_LIST = null;private static final List<String> EMPTY_STR_LIST = new ArrayList<>();@@ -60,16 +57,4 @@ public class CloudHttp2SolrClientBadInputTest extends SolrCloudTestCase {});}}-- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertThat(thrown.getMessage(), containsString(expectedString));- }- }- }}\ No newline at end of filediff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.javaindex 8eb2fb5e0b1..24efb24d936 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java@@ -61,8 +61,7 @@ public class CloudHttp2SolrClientRetryTest extends SolrCloudTestCase {QueryResponse response = solrClient.query(collectionName, params, SolrRequest.METHOD.GET);NamedList<Object> namedList = response.getResponse();System.out.println(namedList);- @SuppressWarnings({"rawtypes"})- NamedList metrics = (NamedList) namedList.get("metrics");+ NamedList<?> metrics = (NamedList<?>) namedList.get("metrics");assertEquals(1L, metrics.get(updateRequestCountKey));TestInjection.failUpdateRequests = "true:100";@@ -78,7 +77,7 @@ public class CloudHttp2SolrClientRetryTest extends SolrCloudTestCase {response = solrClient.query(collectionName, params, SolrRequest.METHOD.GET);namedList = response.getResponse();System.out.println(namedList);- metrics = (NamedList) namedList.get("metrics");+ metrics = (NamedList<?>) namedList.get("metrics");assertEquals(2L, metrics.get(updateRequestCountKey));}}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.javaindex df38ff66ece..9f96eb25255 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java@@ -239,7 +239,6 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {}@Test- @SuppressWarnings({"unchecked"})public void testRouting() throws Exception {CollectionAdminRequest.createCollection("routing_collection", "conf", 2, 1).process(cluster.getSolrClient());cluster.waitForActiveCollection("routing_collection", 2, 2);@@ -254,13 +253,12 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {if (getRandomClient().isDirectUpdatesToLeadersOnly()) {checkSingleServer(response);}- @SuppressWarnings({"rawtypes"})- RouteResponse rr = (RouteResponse) response;- Map<String,LBSolrClient.Req> routes = rr.getRoutes();- Iterator<Map.Entry<String,LBSolrClient.Req>> it = routes.entrySet()+ RouteResponse<?> rr = (RouteResponse<?>) response;+ Map<String,? extends LBSolrClient.Req> routes = rr.getRoutes();+ Iterator<? extends Map.Entry<String,? extends LBSolrClient.Req>> it = routes.entrySet().iterator();while (it.hasNext()) {- Map.Entry<String,LBSolrClient.Req> entry = it.next();+ Map.Entry<String,? extends LBSolrClient.Req> entry = it.next();String url = entry.getKey();UpdateRequest updateRequest = (UpdateRequest) entry.getValue().getRequest();@@ -306,7 +304,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {it = routes.entrySet().iterator();while (it.hasNext()) {- Map.Entry<String,LBSolrClient.Req> entry = it.next();+ Map.Entry<String,? extends LBSolrClient.Req> entry = it.next();String url = entry.getKey();UpdateRequest updateRequest = (UpdateRequest) entry.getValue().getRequest();@@ -841,8 +839,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {response = deleteRequest.commit(getRandomClient(), "versions_collection").getResponse();Object deletesObject = response.get("deletes");assertNotNull("There must be a deletes parameter", deletesObject);- @SuppressWarnings({"rawtypes"})- NamedList deletes = (NamedList) deletesObject;+ NamedList<?> deletes = (NamedList<?>) deletesObject;assertEquals("There must be 1 version", 1, deletes.size());}@@ -936,14 +933,12 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {private static void checkSingleServer(NamedList<Object> response) {- @SuppressWarnings({"rawtypes"})- final RouteResponse rr = (RouteResponse) response;- @SuppressWarnings({"unchecked"})- final Map<String,LBSolrClient.Req> routes = rr.getRoutes();- final Iterator<Map.Entry<String,LBSolrClient.Req>> it =+ final RouteResponse<?> rr = (RouteResponse<?>) response;+ final Map<String,? extends LBSolrClient.Req> routes = rr.getRoutes();+ final Iterator<? extends Map.Entry<String,? extends LBSolrClient.Req>> it =routes.entrySet().iterator();while (it.hasNext()) {- Map.Entry<String,LBSolrClient.Req> entry = it.next();+ Map.Entry<String,? extends LBSolrClient.Req> entry = it.next();assertEquals("wrong number of servers: "+entry.getValue().getServers(),1, entry.getValue().getServers().size());}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.javaindex acace0dc732..9a104d406b4 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java@@ -21,14 +21,11 @@ import java.util.ArrayList;import java.util.List;import com.google.common.collect.Lists;-import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.cloud.SolrCloudTestCase;import org.junit.BeforeClass;import org.junit.Test;-import static org.hamcrest.core.StringContains.containsString;-public class CloudSolrClientBadInputTest extends SolrCloudTestCase {private static final List<String> NULL_STR_LIST = null;private static final List<String> EMPTY_STR_LIST = new ArrayList<>();@@ -60,16 +57,4 @@ public class CloudSolrClientBadInputTest extends SolrCloudTestCase {});}}-- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertThat(thrown.getMessage(), containsString(expectedString));- }- }- }}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.javaindex 73935256174..caf9c329ca2 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java@@ -49,7 +49,6 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {assumeWorkingMockito();}- @SuppressWarnings({"unchecked"})public void testCaching() throws Exception {String collName = "gettingstarted";Set<String> livenodes = new HashSet<>();@@ -75,10 +74,8 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {return colls.get(c);}}- @SuppressWarnings({"rawtypes"})- Map<String, Function> responses = new HashMap<>();- @SuppressWarnings({"rawtypes"})- NamedList okResponse = new NamedList();+ Map<String, Function<?, ?>> responses = new HashMap<>();+ NamedList<Object> okResponse = new NamedList<>();okResponse.add("responseHeader", new NamedList<>(Collections.singletonMap("status", 0)));LBHttpSolrClient mockLbclient = getMockLbHttpSolrClient(responses);@@ -109,13 +106,12 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})private LBHttpSolrClient getMockLbHttpSolrClient(- @SuppressWarnings({"rawtypes"})Map<String, Function> responses) throws Exception {+ Map<String, Function<?,?>> responses) throws Exception {LBHttpSolrClient mockLbclient = mock(LBHttpSolrClient.class);when(mockLbclient.request(any(LBSolrClient.Req.class))).then(invocationOnMock -> {LBHttpSolrClient.Req req = invocationOnMock.getArgument(0);- @SuppressWarnings({"rawtypes"})- Function f = responses.get("request");+ Function<?,?> f = responses.get("request");if (f == null) return null;Object res = f.apply(null);if (res instanceof Exception) throw (Throwable) res;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.javaindex e6f1d10aa72..c1c5416f7c4 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java@@ -835,8 +835,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {response = deleteRequest.commit(getRandomClient(), "versions_collection").getResponse();Object deletesObject = response.get("deletes");assertNotNull("There must be a deletes parameter", deletesObject);- @SuppressWarnings({"rawtypes"})- NamedList deletes = (NamedList) deletesObject;+ NamedList<?> deletes = (NamedList<?>) deletesObject;assertEquals("There must be 1 version", 1, deletes.size());}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.javaindex 6c2728b3e92..dcd7058b23f 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java@@ -21,7 +21,6 @@ import java.util.ArrayList;import java.util.List;import com.google.common.collect.Lists;-import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.SolrJettyTestBase;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;@@ -85,17 +84,4 @@ public class ConcurrentUpdateHttp2SolrClientBadInputTest extends SolrJettyTestBa});}}-- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertTrue("[" + thrown.getMessage() + "] doesn't contain [" + expectedString + "]",- thrown.getMessage().contains(expectedString));- }- }- }}\ No newline at end of filediff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.javaindex 9db0e4d0f64..d911a15a1bc 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java@@ -21,15 +21,12 @@ import java.util.ArrayList;import java.util.List;import com.google.common.collect.Lists;-import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.SolrJettyTestBase;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;import org.junit.BeforeClass;import org.junit.Test;-import static org.hamcrest.core.StringContains.containsString;-public class ConcurrentUpdateSolrClientBadInputTest extends SolrJettyTestBase {private static final List<String> NULL_STR_LIST = null;private static final List<String> EMPTY_STR_LIST = new ArrayList<>();@@ -78,16 +75,4 @@ public class ConcurrentUpdateSolrClientBadInputTest extends SolrJettyTestBase {});}}-- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertThat(thrown.getMessage(), containsString(expectedString));- }- }- }}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.javaindex 6d728b60459..71a059995e0 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java@@ -554,7 +554,7 @@ public class Http2SolrClientTest extends SolrJettyTestBase {}private void verifyServletState(Http2SolrClient client,- @SuppressWarnings({"rawtypes"})SolrRequest request) {+ SolrRequest<?> request) {// check query StringIterator<String> paramNames = request.getParams().getParameterNamesIterator();while (paramNames.hasNext()) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.javaindex 4b1eccc0d4a..10d583db2a5 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java@@ -26,7 +26,6 @@ import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;import org.junit.BeforeClass;import org.junit.Test;-import static org.hamcrest.core.StringContains.containsString;/*** Tests {@link HttpSolrClient}'s response to a variety of bad inputs.@@ -45,18 +44,6 @@ public class HttpSolrClientBadInputTest extends SolrJettyTestBase {createAndStartJetty(legacyExampleCollection1SolrHome(), jettyConfig);}- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertThat(thrown.getMessage(), containsString(expectedString));- }- }- }-@Testpublic void testDeleteByIdReportsInvalidIdLists() throws Exception {try (SolrClient client = getHttpSolrClient(jetty.getBaseUrl().toString() + "/" + ANY_COLLECTION)) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.javaindex 6ce46f0c896..5085e6f4733 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java@@ -21,15 +21,12 @@ import java.util.ArrayList;import java.util.List;import com.google.common.collect.Lists;-import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.SolrJettyTestBase;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;import org.junit.BeforeClass;import org.junit.Test;-import static org.hamcrest.core.StringContains.containsString;-public class LBHttpSolrClientBadInputTest extends SolrJettyTestBase {private static final List<String> NULL_STR_LIST = null;private static final List<String> EMPTY_STR_LIST = new ArrayList<>();@@ -76,16 +73,4 @@ public class LBHttpSolrClientBadInputTest extends SolrJettyTestBase {});}}-- private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,- List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {- @SuppressWarnings({"unchecked"})- Throwable thrown = expectThrows(expectedType, runnable);-- if (expectedStrings != null) {- for (String expectedString : expectedStrings) {- assertThat(thrown.getMessage(), containsString(expectedString));- }- }- }}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.javaindex b7eaa64a580..43d63f71267 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java@@ -40,6 +40,8 @@ import org.junit.Before;import org.junit.BeforeClass;import org.junit.Test;+import static org.apache.solr.client.solrj.io.stream.StreamAssert.assertList;+@Slow@LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40","Lucene41","Lucene42","Lucene45"})public class MathExpressionTest extends SolrCloudTestCase {@@ -140,8 +142,7 @@ public class MathExpressionTest extends SolrCloudTestCase {solrStream.setStreamContext(context);tuples = getTuples(solrStream);assertEquals(tuples.size(), 1);- @SuppressWarnings({"rawtypes"})- List terms = (List)tuples.get(0).get("return-value");+ List<?> terms = (List<?>)tuples.get(0).get("return-value");assertTrue(terms.get(0).equals("hello"));assertTrue(terms.get(1).equals("world"));@@ -205,8 +206,7 @@ public class MathExpressionTest extends SolrCloudTestCase {solrStream.setStreamContext(context);tuples = getTuples(solrStream);assertTrue(tuples.size() == 1);- @SuppressWarnings({"rawtypes"})- List l = (List)tuples.get(0).get("test1_t");+ List<?> l = (List<?>)tuples.get(0).get("test1_t");assertTrue(l.get(0).equals("l"));assertTrue(l.get(1).equals("b"));assertTrue(l.get(2).equals("c"));@@ -313,7 +313,6 @@ public class MathExpressionTest extends SolrCloudTestCase {StreamContext context = new StreamContext();solrStream.setStreamContext(context);- @SuppressWarnings({"unchecked"})List<Tuple> tuples = getTuples(solrStream);assertEquals(tuples.size(), 1);@SuppressWarnings({"unchecked"})@@ -6287,21 +6286,4 @@ public void testCache() throws Exception {return true;}-- private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {-- if(list.size() != vals.length) {- throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);- }-- for(int i=0; i<list.size(); i++) {- Object a = list.get(i);- Object b = vals[i];- if(!a.equals(b)) {- throw new Exception("List items not equals:"+a+" : "+b);- }- }-- return true;- }}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ParallelFacetStreamOverAliasTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ParallelFacetStreamOverAliasTest.javaindex 25a67f9c039..aede95bc43f 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ParallelFacetStreamOverAliasTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ParallelFacetStreamOverAliasTest.java@@ -275,7 +275,7 @@ public class ParallelFacetStreamOverAliasTest extends SolrCloudTestCase {private SortedMap<Object, Object> toComparableMap(Tuple t) {SortedMap<Object, Object> cmap = new TreeMap<>();- for (Map.Entry<Object, Object> e : t.getFields().entrySet()) {+ for (Map.Entry<String, Object> e : t.getFields().entrySet()) {Object value = e.getValue();if (value instanceof Double) {cmap.put(e.getKey(), Precision.round((Double) value, 5));diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.javaindex 2fa0dd09335..cfea403d406 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java@@ -156,8 +156,7 @@ public class SelectWithEvaluatorsTest extends SolrCloudTestCase {int i = 0;for(int val : ids) {Tuple t = tuples.get(i);- @SuppressWarnings({"rawtypes"})- List<Map> tip = t.getMaps("group");+ List<Map<?,?>> tip = t.getMaps("group");int id = (int)tip.get(0).get("id");if(id != val) {throw new Exception("Found value:"+id+" expecting:"+val);@@ -231,40 +230,4 @@ public class SelectWithEvaluatorsTest extends SolrCloudTestCase {return true;}-- protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {- if(maps.size() != ids.length) {- throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());- }-- int i=0;- for(int val : ids) {- @SuppressWarnings({"rawtypes"})- Map t = maps.get(i);- String tip = (String)t.get("id");- if(!tip.equals(Integer.toString(val))) {- throw new Exception("Found value:"+tip+" expecting:"+val);- }- ++i;- }- return true;- }-- private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {-- if(list.size() != vals.length) {- throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);- }-- for(int i=0; i<list.size(); i++) {- Object a = list.get(i);- Object b = vals[i];- if(!a.equals(b)) {- throw new Exception("List items not equals:"+a+" : "+b);- }- }-- return true;- }-}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamAssert.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamAssert.javanew file mode 100644index 00000000000..308da53569b--- /dev/null+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamAssert.java@@ -0,0 +1,55 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.solr.client.solrj.io.stream;++import java.util.List;+import java.util.Map;++class StreamAssert {+ static boolean assertMaps(List<Map<?, ?>> maps, int... ids) throws Exception {+ if(maps.size() != ids.length) {+ throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());+ }++ int i=0;+ for(int val : ids) {+ Map<?,?> t = maps.get(i);+ String tip = (String)t.get("id");+ if(!tip.equals(Integer.toString(val))) {+ throw new Exception("Found value:"+tip+" expecting:"+val);+ }+ ++i;+ }+ return true;+ }++ static boolean assertList(List<?> list, Object... vals) throws Exception {+ if(list.size() != vals.length) {+ throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);+ }++ for(int i=0; i<list.size(); i++) {+ Object a = list.get(i);+ Object b = vals[i];+ if(!a.equals(b)) {+ throw new Exception("List items not equals:"+a+" : "+b);+ }+ }++ return true;+ }+}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.javaindex 4d775402737..2a048fab257 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java@@ -70,6 +70,9 @@ import org.junit.Before;import org.junit.BeforeClass;import org.junit.Test;+import static org.apache.solr.client.solrj.io.stream.StreamAssert.assertList;+import static org.apache.solr.client.solrj.io.stream.StreamAssert.assertMaps;+@Slow@SolrTestCaseJ4.SuppressSSL@LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40","Lucene41","Lucene42","Lucene45"})@@ -494,8 +497,7 @@ public class StreamDecoratorTest extends SolrCloudTestCase {TupleStream stream;List<Tuple> tuples;Tuple t0, t1, t2;- @SuppressWarnings({"rawtypes"})- List<Map> maps0, maps1, maps2;+ List<Map<?,?>> maps0, maps1, maps2;StreamContext streamContext = new StreamContext();SolrClientCache solrClientCache = new SolrClientCache();streamContext.setSolrClientCache(solrClientCache);@@ -1566,18 +1568,15 @@ public class StreamDecoratorTest extends SolrCloudTestCase {assert (tuples.size() == 3);Tuple t0 = tuples.get(0);- @SuppressWarnings({"rawtypes"})- List<Map> maps0 = t0.getMaps("group");+ List<Map<?,?>> maps0 = t0.getMaps("group");assertMaps(maps0, 0, 1, 2, 9);Tuple t1 = tuples.get(1);- @SuppressWarnings({"rawtypes"})- List<Map> maps1 = t1.getMaps("group");+ List<Map<?,?>> maps1 = t1.getMaps("group");assertMaps(maps1, 3, 5, 7, 8);Tuple t2 = tuples.get(2);- @SuppressWarnings({"rawtypes"})- List<Map> maps2 = t2.getMaps("group");+ List<Map<?,?>> maps2 = t2.getMaps("group");assertMaps(maps2, 4, 6);@@ -4541,39 +4540,5 @@ public class StreamDecoratorTest extends SolrCloudTestCase {return true;}-- protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {- if(maps.size() != ids.length) {- throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());- }- int i=0;- for(int val : ids) {- @SuppressWarnings({"rawtypes"})- Map t = maps.get(i);- String tip = (String)t.get("id");- if(!tip.equals(Integer.toString(val))) {- throw new Exception("Found value:"+tip+" expecting:"+val);- }- ++i;- }- return true;- }-- private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {-- if(list.size() != vals.length) {- throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);- }-- for(int i=0; i<list.size(); i++) {- Object a = list.get(i);- Object b = vals[i];- if(!a.equals(b)) {- throw new Exception("List items not equals:"+a+" : "+b);- }- }-- return true;- }}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.javaindex 9daa1e77fca..c03476a774f 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java@@ -4032,24 +4032,6 @@ public class StreamExpressionTest extends SolrCloudTestCase {return true;}- protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {- if(maps.size() != ids.length) {- throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());- }-- int i=0;- for(int val : ids) {- @SuppressWarnings({"rawtypes"})- Map t = maps.get(i);- String tip = (String)t.get("id");- if(!tip.equals(Integer.toString(val))) {- throw new Exception("Found value:"+tip+" expecting:"+val);- }- ++i;- }- return true;- }-private void assertTopicRun(TupleStream stream, String... idArray) throws Exception {long version = -1;int count = 0;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.javaindex 2ae9d7a77c3..208f0550736 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java@@ -65,6 +65,8 @@ import org.junit.BeforeClass;import org.junit.Ignore;import org.junit.Test;+import static org.apache.solr.client.solrj.io.stream.StreamAssert.assertMaps;+/*** All base tests will be done with CloudSolrStream. Under the covers CloudSolrStream uses SolrStream so* SolrStream will get fully exercised through these tests.@@ -425,18 +427,15 @@ public void testParallelRankStream() throws Exception {assertEquals(3, tuples.size());Tuple t0 = tuples.get(0);- @SuppressWarnings({"rawtypes"})- List<Map> maps0 = t0.getMaps("group");+ List<Map<?,?>> maps0 = t0.getMaps("group");assertMaps(maps0, 0, 2, 1, 9);Tuple t1 = tuples.get(1);- @SuppressWarnings({"rawtypes"})- List<Map> maps1 = t1.getMaps("group");+ List<Map<?,?>> maps1 = t1.getMaps("group");assertMaps(maps1, 3, 5, 7, 8);Tuple t2 = tuples.get(2);- @SuppressWarnings({"rawtypes"})- List<Map> maps2 = t2.getMaps("group");+ List<Map<?,?>> maps2 = t2.getMaps("group");assertMaps(maps2, 4, 6);//Test with spaces in the parameter lists using a comparator@@ -538,18 +537,15 @@ public void testParallelRankStream() throws Exception {assertEquals(3, tuples.size());Tuple t0 = tuples.get(0);- @SuppressWarnings({"rawtypes"})- List<Map> maps0 = t0.getMaps("group");+ List<Map<?,?>> maps0 = t0.getMaps("group");assertMaps(maps0, 9, 1, 2, 0);Tuple t1 = tuples.get(1);- @SuppressWarnings({"rawtypes"})- List<Map> maps1 = t1.getMaps("group");+ List<Map<?,?>> maps1 = t1.getMaps("group");assertMaps(maps1, 8, 7, 5, 3);Tuple t2 = tuples.get(2);- @SuppressWarnings({"rawtypes"})- List<Map> maps2 = t2.getMaps("group");+ List<Map<?,?>> maps2 = t2.getMaps("group");assertMaps(maps2, 6, 4);//Test Descending with Ascending subsort@@ -2332,7 +2328,6 @@ public void testParallelRankStream() throws Exception {* streaming expression to only consider data found on the local node.*/@Test- @SuppressWarnings({"unchecked"})public void streamLocalTests() throws Exception {new UpdateRequest()@@ -2668,24 +2663,6 @@ public void testParallelRankStream() throws Exception {return true;}- protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {- if(maps.size() != ids.length) {- throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());- }-- int i=0;- for(int val : ids) {- @SuppressWarnings({"rawtypes"})- Map t = maps.get(i);- String tip = (String)t.get("id");- if(!tip.equals(Integer.toString(val))) {- throw new Exception("Found value:"+tip+" expecting:"+val);- }- ++i;- }- return true;- }-public boolean assertLong(Tuple tuple, String fieldName, long l) throws Exception {long lv = (long)tuple.get(fieldName);if(lv != l) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.javaindex 5de2412b825..c0098b47dd6 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java@@ -69,8 +69,7 @@ public class ConversionEvaluatorsTest {evaluator = factory.constructEvaluator("convert(inches, yards, 3)");StreamContext streamContext = new StreamContext();evaluator.setStreamContext(streamContext);- @SuppressWarnings({"rawtypes"})- Tuple tuple = new Tuple(new HashMap());+ Tuple tuple = new Tuple(new HashMap<>());evaluator.evaluate(tuple);assertTrue(false);} catch (IOException e) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.javaindex e70a86595e9..167ead9f8f1 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java@@ -47,8 +47,7 @@ public class ReverseEvaluatorTest extends SolrTestCase {values.clear();values.put("l1", l1);- @SuppressWarnings({"rawtypes"})- List result = ((List<?>)factory.constructEvaluator("reverse(l1)").evaluate(new Tuple(values)));+ List<?> result = ((List<?>)factory.constructEvaluator("reverse(l1)").evaluate(new Tuple(values)));Assert.assertEquals(4.5, result.get(0));Assert.assertEquals(6.7, result.get(1));diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.javaindex cb654554f51..78f0eabcf32 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java@@ -62,13 +62,11 @@ public class SchemaTest extends RestTestBase {private static void assertFailedSchemaResponse(ThrowingRunnable runnable, String expectedErrorMessage) {BaseHttpSolrClient.RemoteExecutionException e = expectThrows(BaseHttpSolrClient.RemoteExecutionException.class, runnable);- @SuppressWarnings({"rawtypes"})- SimpleOrderedMap errorMap = (SimpleOrderedMap)e.getMetaData().get("error");+ SimpleOrderedMap<?> errorMap = (SimpleOrderedMap<?>)e.getMetaData().get("error");assertEquals("org.apache.solr.api.ApiBag$ExceptionWithErrObject",((NamedList)errorMap.get("metadata")).get("error-class"));- @SuppressWarnings({"rawtypes"})- List details = (List)errorMap.get("details");- assertTrue(((List)((Map)details.get(0)).get("errorMessages")).get(0).toString().contains(expectedErrorMessage));+ List<?> details = (List<?>)errorMap.get("details");+ assertTrue(((List<?>)((Map<?,?>)details.get(0)).get("errorMessages")).get(0).toString().contains(expectedErrorMessage));}private static void createStoredStringField(String fieldName, SolrClient solrClient) throws Exception {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.javaindex 5c78159481b..f1da3fe6dec 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java@@ -28,8 +28,7 @@ public class TestConfigSetAdminRequest extends SolrTestCaseJ4 {@Testpublic void testNoAction() {- @SuppressWarnings({"rawtypes"})- ConfigSetAdminRequest request = new MyConfigSetAdminRequest();+ MyConfigSetAdminRequest request = new MyConfigSetAdminRequest();verifyException(request, "action");}@@ -47,7 +46,7 @@ public class TestConfigSetAdminRequest extends SolrTestCaseJ4 {verifyException(delete, "ConfigSet");}- private void verifyException(@SuppressWarnings({"rawtypes"})ConfigSetAdminRequest request, String errorContains) {+ private void verifyException(ConfigSetAdminRequest<?,?> request, String errorContains) {Exception e = expectThrows(Exception.class, request::getParams);assertTrue("Expected exception message to contain: " + errorContains,e.getMessage().contains(errorContains));diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.javaindex fad66ed6839..2e9b5e8de30 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java@@ -264,7 +264,6 @@ public class TestUpdateRequestCodec extends SolrTestCase {}- @SuppressWarnings({"unchecked", "rawtypes"})private void compareDocs(String m,SolrInputDocument expectedDoc,SolrInputDocument actualDoc) {@@ -278,9 +277,9 @@ public class TestUpdateRequestCodec extends SolrTestCase {actualVal instanceof Collection) {// unmarshaled documents never contain Sets, they are just a// List in an arbitrary order based on what the iterator of- // hte original Set returned, so we need a comparison that is+ // the original Set returned, so we need a comparison that is// order agnostic.- actualVal = new HashSet((Collection) actualVal);+ actualVal = new HashSet<>((Collection<?>) actualVal);m += " (Set comparison)";}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.javaindex cfca2f6d9a3..9c459d57a90 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java@@ -53,8 +53,7 @@ public class TestV2Request extends SolrCloudTestCase {.forceV2(true).withMethod(SolrRequest.METHOD.GET).build().process(cluster.getSolrClient());- @SuppressWarnings({"rawtypes"})- List l = (List) rsp._get("nodes",null);+ List<?> l = (List<?>) rsp._get("nodes",null);assertNotNull(l);assertFalse(l.isEmpty());rsp = new V2Request.Builder("/cluster/aliases")diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.javaindex 803769f54ad..108545acf14 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java@@ -29,7 +29,6 @@ import java.util.List;** @since solr 1.4*/-@SuppressWarnings("unchecked")public class AnlysisResponseBaseTest extends SolrTestCase {/**@@ -38,8 +37,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {@Testpublic void testBuildTokenInfo() throws Exception {- @SuppressWarnings({"rawtypes"})- NamedList tokenNL = new NamedList();+ NamedList<Object> tokenNL = new NamedList<>();tokenNL.add("text", "JUMPING");tokenNL.add("type", "word");tokenNL.add("start", 0);@@ -77,8 +75,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {public void testBuildPhases() throws Exception {final AnalysisResponseBase.TokenInfo tokenInfo = new AnalysisResponseBase.TokenInfo("text", null, "type", 0, 3, 1, false);- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();nl.add("Tokenizer", buildFakeTokenInfoList(6));nl.add("Filter1", buildFakeTokenInfoList(5));nl.add("Filter2", buildFakeTokenInfoList(4));@@ -86,7 +83,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {AnalysisResponseBase response = new AnalysisResponseBase() {@Override- protected TokenInfo buildTokenInfo(@SuppressWarnings({"rawtypes"})NamedList tokenNL) {+ protected TokenInfo buildTokenInfo(NamedList<?> ignored) {return tokenInfo;}};@@ -106,8 +103,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {*/@Testpublic void testCharFilterBuildPhases() throws Exception {- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();nl.add("CharFilter1", "CharFilterOutput"); //not list of tokensAnalysisResponseBase response = new AnalysisResponseBase();List<AnalysisResponseBase.AnalysisPhase> phases = response.buildPhases(nl);@@ -116,11 +112,10 @@ public class AnlysisResponseBaseTest extends SolrTestCase {//================================================ Helper Methods ==================================================- @SuppressWarnings({"rawtypes"})- private List<NamedList> buildFakeTokenInfoList(int numberOfTokens) {- List<NamedList> list = new ArrayList<>(numberOfTokens);+ private List<NamedList<?>> buildFakeTokenInfoList(int numberOfTokens) {+ List<NamedList<?>> list = new ArrayList<>(numberOfTokens);for (int i = 0; i < numberOfTokens; i++) {- list.add(new NamedList());+ list.add(new NamedList<>());}return list;}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.javaindex 546cd0389f0..32ba7ace07d 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java@@ -35,7 +35,6 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {* Tests the {@link DocumentAnalysisResponse#setResponse(org.apache.solr.common.util.NamedList)} method*/@Test- @SuppressWarnings({"unchecked", "rawtypes"})public void testSetResponse() throws Exception {// the parsing of the analysis phases is already tested in the AnalysisResponseBaseTest. So we can just fake@@ -44,7 +43,7 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {AnalysisResponseBase.AnalysisPhase expectedPhase = new AnalysisResponseBase.AnalysisPhase("Tokenizer");phases.add(expectedPhase);- NamedList responseNL = buildResponse();+ NamedList<Object> responseNL = buildResponse();DocumentAnalysisResponse response = new DocumentAnalysisResponse() {@Override@@ -97,15 +96,14 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {//================================================ Helper Methods ==================================================- @SuppressWarnings({"unchecked", "rawtypes"})- private NamedList buildResponse() {+ private NamedList<Object> buildResponse() {- NamedList response = new NamedList();+ NamedList<Object> response = new NamedList<>();- NamedList responseHeader = new NamedList();+ NamedList<Object> responseHeader = new NamedList<>();response.add("responseHeader", responseHeader);- NamedList params = new NamedList();+ NamedList<String> params = new NamedList<>();responseHeader.add("params", params);params.add("analysis.showmatch", "true");params.add("analysis.query", "the query");@@ -113,39 +111,39 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {responseHeader.add("status", 0);responseHeader.add("QTime", 105);- NamedList analysis = new NamedList();+ NamedList<Object> analysis = new NamedList<>();response.add("analysis", analysis);- NamedList doc1 = new NamedList();+ NamedList<Object> doc1 = new NamedList<>();analysis.add("1", doc1);- NamedList id = new NamedList();+ NamedList<Object> id = new NamedList<>();doc1.add("id", id);- NamedList query = new NamedList();+ NamedList<Object> query = new NamedList<>();id.add("query", query);- NamedList index = new NamedList();+ NamedList<Object> index = new NamedList<>();id.add("index", index);- NamedList idValue = new NamedList();+ NamedList<?> idValue = new NamedList<>();index.add("1", idValue);- NamedList name = new NamedList();+ NamedList<Object> name = new NamedList<>();doc1.add("name", name);- query = new NamedList();+ query = new NamedList<>();name.add("query", query);- index = new NamedList();+ index = new NamedList<>();name.add("index", index);- NamedList nameValue1 = new NamedList();+ NamedList<?> nameValue1 = new NamedList<>();index.add("name value 1", nameValue1);- NamedList nameValue2 = new NamedList();+ NamedList<?> nameValue2 = new NamedList<>();index.add("name value 2", nameValue2);- NamedList text = new NamedList();+ NamedList<Object> text = new NamedList<>();doc1.add("text", text);- query = new NamedList();+ query = new NamedList<>();text.add("query", query);- index = new NamedList();+ index = new NamedList<>();text.add("index", index);- NamedList textValue = new NamedList();+ NamedList<?> textValue = new NamedList<>();index.add("text value", textValue);return response;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.javaindex b609dfb5d5e..15f1ad0e624 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java@@ -30,7 +30,6 @@ import java.util.List;** @since solr 1.4*/-@SuppressWarnings("unchecked")public class FieldAnalysisResponseTest extends SolrTestCase {/**@@ -45,8 +44,7 @@ public class FieldAnalysisResponseTest extends SolrTestCase {AnalysisResponseBase.AnalysisPhase expectedPhase = new AnalysisResponseBase.AnalysisPhase("Tokenizer");phases.add(expectedPhase);- @SuppressWarnings({"rawtypes"})- NamedList responseNL = buildResponse();+ NamedList<Object> responseNL = buildResponse();FieldAnalysisResponse response = new FieldAnalysisResponse() {@Overrideprotected List<AnalysisPhase> buildPhases(NamedList<Object> phaseNL) {@@ -80,14 +78,13 @@ public class FieldAnalysisResponseTest extends SolrTestCase {//================================================ Helper Methods ==================================================- @SuppressWarnings({"rawtypes"})- private NamedList buildResponse() {- NamedList response = new NamedList();+ private NamedList<Object> buildResponse() {+ NamedList<Object> response = new NamedList<>();- NamedList responseHeader = new NamedList();+ NamedList<Object> responseHeader = new NamedList<>();response.add("responseHeader", responseHeader);- NamedList params = new NamedList();+ NamedList<String> params = new NamedList<>();responseHeader.add("params", params);params.add("analysis.showmatch", "true");params.add("analysis.query", "the query");@@ -98,25 +95,25 @@ public class FieldAnalysisResponseTest extends SolrTestCase {responseHeader.add("status", 0);responseHeader.add("QTime", 66);- NamedList analysis = new NamedList();+ NamedList<Object> analysis = new NamedList<>();response.add("analysis", analysis);- NamedList fieldTypes = new NamedList();+ NamedList<Object> fieldTypes = new NamedList<>();analysis.add("field_types", fieldTypes);- NamedList text = new NamedList();+ NamedList<Object> text = new NamedList<>();fieldTypes.add("text", text);- NamedList index = new NamedList();+ NamedList<Object> index = new NamedList<>();text.add("index", index);- NamedList query = new NamedList();+ NamedList<?> query = new NamedList<>();text.add("query", query);- NamedList fieldNames = new NamedList();+ NamedList<Object> fieldNames = new NamedList<>();analysis.add("field_names", fieldNames);- NamedList name = new NamedList();+ NamedList<Object> name = new NamedList<>();fieldNames.add("name", name);- index = new NamedList();+ index = new NamedList<>();name.add("index", index);- query = new NamedList();+ query = new NamedList<>();name.add("query", query);return response;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.javaindex cc1e8ade0cd..26fcb13050d 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java@@ -87,8 +87,7 @@ public class NoOpResponseParserTest extends SolrJettyTestBase {private void assertResponse(String responseString) throws IOException {ResponseParser xmlResponseParser = new XMLResponseParser();- @SuppressWarnings({"rawtypes"})- NamedList expectedResponse = xmlResponseParser.processResponse(IOUtils.toInputStream(responseString, "UTF-8"), "UTF-8");+ NamedList<?> expectedResponse = xmlResponseParser.processResponse(IOUtils.toInputStream(responseString, "UTF-8"), "UTF-8");@SuppressWarnings({"unchecked"})List<SolrDocument> documentList = (List<SolrDocument>) expectedResponse.getAll("response").get(0);assertEquals(1, documentList.size());diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.javaindex 7cfaaff1f63..7c85961d0f5 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java@@ -43,7 +43,6 @@ import org.junit.Test;* @since solr 1.3*/@Limit(bytes=20000)-@SuppressWarnings({"rawtypes"})public class QueryResponseTest extends SolrTestCase {@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018@@ -65,7 +64,7 @@ public class QueryResponseTest extends SolrTestCase {int counter = 0;RangeFacet.Numeric price = null;RangeFacet.Date manufacturedateDt = null;- for (RangeFacet r : qr.getFacetRanges()){+ for (RangeFacet<?,?> r : qr.getFacetRanges()){assertNotNull(r);if ("price".equals(r.getName())) {price = (RangeFacet.Numeric) r;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.javaindex 54b8e6cc32c..e989bc55e49 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java@@ -34,7 +34,7 @@ import org.noggit.JSONWriter;public class TestDelegationTokenResponse extends SolrTestCase {- private void delegationTokenResponse(@SuppressWarnings({"rawtypes"})DelegationTokenRequest request,+ private void delegationTokenResponse(DelegationTokenRequest<?,?> request,DelegationTokenResponse response, String responseBody) throws Exception {ResponseParser parser = request.getResponseParser();response.setResponse(parser.processResponse(diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/routing/ReplicaListTransformerTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/routing/ReplicaListTransformerTest.javaindex 07069859a17..77eee05dd62 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/routing/ReplicaListTransformerTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/routing/ReplicaListTransformerTest.java@@ -50,7 +50,7 @@ public class ReplicaListTransformerTest extends SolrTestCase {this.regex = regex;}- public void transform(List<?> choices)+ public <T> void transform(List<T> choices){log.info("regex transform input: {}", choices);Iterator<?> it = choices.iterator();@@ -82,7 +82,7 @@ public class ReplicaListTransformerTest extends SolrTestCase {{}- public void transform(List<?> choices)+ public <T> void transform(List<T> choices){// no-oplog.info("No-Op transform ignoring input: {}", choices);diff --git a/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java b/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.javaindex 1d931a3f22d..de363cbb89f 100644--- a/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java+++ b/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java@@ -128,11 +128,9 @@ public class SolrDocumentTest extends SolrTestCasedoc.clear();assertEquals( 0, doc.getFieldNames().size() );- @SuppressWarnings({"rawtypes"})- Iterable iter = new Iterable() {+ Iterable<String> iter = new Iterable<>() {@Override- @SuppressWarnings({"rawtypes"})- public Iterator iterator() {+ public Iterator<String> iterator() {return c0.iterator();}};diff --git a/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java b/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.javaindex 8e4a24e20a1..3d8fc6a329f 100644--- a/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java+++ b/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java@@ -67,11 +67,9 @@ public class TestToleratedUpdateError extends SolrTestCase {assertTrue(e.toString(), e.getMessage().contains("Invalid type"));}- @SuppressWarnings({"unchecked"})public void testParseMap() {// trivial- @SuppressWarnings({"rawtypes"})- SimpleOrderedMap valid = new SimpleOrderedMap<String>();+ SimpleOrderedMap<String> valid = new SimpleOrderedMap<>();valid.add("type", CmdType.ADD.toString());valid.add("id", "some id");valid.add("message", "some message");diff --git a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.javaindex d31d878d5db..bcb45b44c5c 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java@@ -197,13 +197,10 @@ public class NamedListTest extends SolrTestCase {@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018- @SuppressWarnings({"unchecked"})public void testShallowMap() {- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();+ NamedList<String> nl = new NamedList<>();nl.add("key1", "Val1");- @SuppressWarnings({"rawtypes"})- Map m = nl.asShallowMap();+ Map<String,String> m = nl.asShallowMap();m.put("key1", "Val1_");assertEquals("Val1_", nl.get("key1"));assertEquals("Val1_", m.get("key1"));diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java b/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.javaindex 47fef9a1783..3ea5f44c56a 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java@@ -187,7 +187,6 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {parser.processResponse(new FastInputStream(null, baos.getbuf(), 0, baos.size()), null);}- @SuppressWarnings({"unchecked"})public void testParsingWithChildDocs() throws IOException {SolrDocument d1 = TestJavaBinCodec.generateSolrDocumentWithChildDocs();d1.setField("id", "101");@@ -201,8 +200,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {sdocs.add(d1);sdocs.add(d2);- @SuppressWarnings({"rawtypes"})- SimpleOrderedMap orderedMap = new SimpleOrderedMap();+ SimpleOrderedMap<SolrDocumentList> orderedMap = new SimpleOrderedMap<>();orderedMap.add("response", sdocs);BinaryRequestWriter.BAOS baos = new BinaryRequestWriter.BAOS();diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.javaindex 4724f19ce90..9f789215ba2 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java@@ -105,7 +105,6 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {return parentDocument;}- @SuppressWarnings({"unchecked"})private List<Object> generateAllDataTypes() {List<Object> types = new ArrayList<>();@@ -173,8 +172,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {types.add(1);types.add((long) 2);- @SuppressWarnings({"rawtypes"})- SimpleOrderedMap simpleOrderedMap = new SimpleOrderedMap();+ SimpleOrderedMap<String> simpleOrderedMap = new SimpleOrderedMap<>();simpleOrderedMap.add("bar", "barbar");types.add(simpleOrderedMap);@@ -204,8 +202,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {}- private void compareObjects(@SuppressWarnings({"rawtypes"})List unmarshaledObj,- @SuppressWarnings({"rawtypes"})List matchObj) {+ private void compareObjects(List<?> unmarshaledObj, List<?> matchObj) {assertEquals(unmarshaledObj.size(), matchObj.size());for (int i = 0; i < unmarshaledObj.size(); i++) {@@ -560,7 +557,6 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {}- @SuppressWarnings({"unchecked"})public static void doDecodePerf(String[] args) throws Exception {int arg=0;int nThreads = Integer.parseInt(args[arg++]);@@ -600,8 +596,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {int ret = 0;final RTimer timer = new RTimer();- @SuppressWarnings({"rawtypes"})- ConcurrentLRUCache underlyingCache = cacheSz > 0 ? new ConcurrentLRUCache<>(cacheSz,cacheSz-cacheSz/10,cacheSz,cacheSz/10,false,true,null) : null; // the cache in the first version of the patch was 10000,9000,10000,1000,false,true,null+ ConcurrentLRUCache<StringBytes, String> underlyingCache = cacheSz > 0 ? new ConcurrentLRUCache<>(cacheSz,cacheSz-cacheSz/10,cacheSz,cacheSz/10,false,true,null) : null; // the cache in the first version of the patch was 10000,9000,10000,1000,false,true,nullfinal JavaBinCodec.StringCache stringCache = underlyingCache==null ? null : new JavaBinCodec.StringCache(underlyingCache);if (nThreads <= 0) {ret += doDecode(buffers, iter, stringCache);diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.javaindex 070dfe6961e..718076ea383 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java@@ -33,23 +33,22 @@ import java.util.HashMap;public class TestNamedListCodec extends SolrTestCase {@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018- @SuppressWarnings({"unchecked", "rawtypes"})public void testSimple() throws Exception{- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();Float fval = 10.01f;Boolean bval = Boolean.TRUE;String sval = "12qwaszx";// Set up a simple document- NamedList r = new NamedList();+ NamedList<Object> r = new NamedList<>();nl.add("responseHeader", r);r.add("status",0);r.add("QTime",63);- NamedList p = new NamedList();+ NamedList<Object> p = new NamedList<>();r.add("params",p);p.add("rows",10);p.add("start",0);@@ -84,34 +83,27 @@ public class TestNamedListCodec extends SolrTestCase {arr = baos.toByteArray();}try (JavaBinCodec jbc = new JavaBinCodec(); ByteArrayInputStream bais = new ByteArrayInputStream(arr)) {- nl = (NamedList) jbc.unmarshal(bais);+ NamedList<?> res = (NamedList<?>) jbc.unmarshal(bais);+ assertEquals(3, res.size());+ assertEquals( "ipod",((NamedList<?>)((NamedList<?>)res.getVal(0)).get("params")).get("q") );+ list = (SolrDocumentList) res.getVal(1);+ assertEquals(12,list.getNumFound() );+ assertEquals(10,list.getStart() );+ assertEquals(101, ((List)list.get(1).getFieldValue("f")).get(1));}--- assertEquals(3, nl.size());- assertEquals( "ipod",((NamedList)((NamedList)nl.getVal(0)).get("params")).get("q") );- list = (SolrDocumentList) nl.getVal(1);- assertEquals(12,list.getNumFound() );- assertEquals(10,list.getStart() );- assertEquals(101, ((List)list.get(1).getFieldValue("f")).get(1));}@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018- @SuppressWarnings({"unchecked"})public void testIterator() throws Exception{- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();Float fval = 10.01f;Boolean bval = Boolean.TRUE;String sval = "12qwaszx";// Set up a simple document- @SuppressWarnings({"rawtypes"})- NamedList r = new NamedList();- @SuppressWarnings({"rawtypes"})- List list = new ArrayList();+ List<SolrDocument> list = new ArrayList<>();SolrDocument doc = new SolrDocument();doc.addField( "f", fval );@@ -134,22 +126,16 @@ public class TestNamedListCodec extends SolrTestCase {arr = baos.toByteArray();}try (JavaBinCodec jbc = new JavaBinCodec(); ByteArrayInputStream bais = new ByteArrayInputStream(arr)) {- nl = (NamedList) jbc.unmarshal(bais);+ NamedList<?> res = (NamedList<?>) jbc.unmarshal(bais);+ List<?> l = (List<?>) res.get("zzz");+ assertEquals(list.size(), l.size());}-- @SuppressWarnings({"rawtypes"})- List l = (List) nl.get("zzz");- assertEquals(list.size(), l.size());}@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018- @SuppressWarnings({"unchecked"})public void testIterable() throws Exception {--- @SuppressWarnings({"rawtypes"})- NamedList r = new NamedList();+ NamedList<Object> r = new NamedList<>();Map<String, String> map = new HashMap<>();map.put("foo", "bar");@@ -167,18 +153,15 @@ public class TestNamedListCodec extends SolrTestCase {}try (JavaBinCodec jbc = new JavaBinCodec(); ByteArrayInputStream bais = new ByteArrayInputStream(arr)) {- @SuppressWarnings({"rawtypes"})- NamedList result = (NamedList) jbc.unmarshal(bais);+ NamedList<?> result = (NamedList<?>) jbc.unmarshal(bais);assertTrue("result is null and it shouldn't be", result != null);- @SuppressWarnings({"rawtypes"})- List keys = (List) result.get("keys");+ List<?> keys = (List<?>) result.get("keys");assertTrue("keys is null and it shouldn't be", keys != null);assertTrue("keys Size: " + keys.size() + " is not: " + 3, keys.size() == 3);String less = (String) result.get("more");assertTrue("less is null and it shouldn't be", less != null);assertTrue(less + " is not equal to " + "less", less.equals("less") == true);- @SuppressWarnings({"rawtypes"})- List values = (List) result.get("values");+ List<?> values = (List<?>) result.get("values");assertTrue("values is null and it shouldn't be", values != null);assertTrue("values Size: " + values.size() + " is not: " + 3, values.size() == 3);String theEnd = (String) result.get("finally");@@ -210,20 +193,18 @@ public class TestNamedListCodec extends SolrTestCase {}- @SuppressWarnings({"unchecked", "rawtypes"})- public NamedList rNamedList(int lev) {+ public NamedList<Object> rNamedList(int lev) {int sz = lev<= 0 ? 0 : r.nextInt(3);- NamedList nl = new NamedList();+ NamedList<Object> nl = new NamedList<>();for (int i=0; i<sz; i++) {nl.add(rStr(2), makeRandom(lev-1));}return nl;}- @SuppressWarnings({"unchecked", "rawtypes"})- public List rList(int lev) {+ public List<Object> rList(int lev) {int sz = lev<= 0 ? 0 : r.nextInt(3);- ArrayList lst = new ArrayList();+ ArrayList<Object> lst = new ArrayList<>();for (int i=0; i<sz; i++) {lst.add(makeRandom(lev-1));}@@ -272,10 +253,8 @@ public class TestNamedListCodec extends SolrTestCase {// let's keep it deterministic since just the wrong// random stuff could cause failure because of an OOM (too big)- @SuppressWarnings({"rawtypes"})- NamedList nl;- @SuppressWarnings({"rawtypes"})- NamedList res;+ NamedList<Object> nl;+ NamedList<?> res;String cmp;for (int i=0; i<10000; i++) { // pump up the iterations for good stress testing@@ -287,7 +266,7 @@ public class TestNamedListCodec extends SolrTestCase {}// System.out.println(arr.length);try (JavaBinCodec jbc = new JavaBinCodec(); ByteArrayInputStream bais = new ByteArrayInputStream(arr)) {- res = (NamedList) jbc.unmarshal(bais);+ res = (NamedList<?>) jbc.unmarshal(bais);cmp = BaseDistributedSearchTestCase.compare(nl, res, 0, null);}if (cmp != null) {diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java b/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.javaindex 2b1ad42fab6..97da841f055 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java@@ -30,7 +30,6 @@ import static org.apache.solr.api.ApiBag.HANDLER_NAME;public class TestPathTrie extends SolrTestCaseJ4 {- @SuppressWarnings({"unchecked"})public void testPathTrie() {PathTrie<String> pathTrie = new PathTrie<>(ImmutableSet.of("_introspect"));pathTrie.insert("/", emptyMap(), "R");@@ -40,8 +39,7 @@ public class TestPathTrie extends SolrTestCaseJ4 {pathTrie.insert("/aa/bb/{cc}/{xx}", emptyMap(), "b");pathTrie.insert("/aa/bb", emptyMap(), "c");- @SuppressWarnings({"rawtypes"})- HashMap templateValues = new HashMap<>();+ HashMap<String,String> templateValues = new HashMap<>();assertEquals("R", pathTrie.lookup("/", templateValues, null));assertEquals("d", pathTrie.lookup("/aa", templateValues, null));assertEquals("a", pathTrie.lookup("/aa/bb/hello/dd", templateValues, null));diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java b/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.javaindex 6adab7fbd4c..2783e86d4d7 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java@@ -42,8 +42,7 @@ public class TestValidatingJsonMap extends SolrTestCaseJ4 {expectThrows(RuntimeException.class, () -> m.getList("l", ENUM_OF, ImmutableSet.of("X", "Z")));- @SuppressWarnings({"rawtypes"})- List l = m.getList("l", ENUM_OF, ImmutableSet.of("X", "Y", "Z"));+ List<?> l = m.getList("l", ENUM_OF, ImmutableSet.of("X", "Y", "Z"));assertEquals(2,l.size());m.getList("l", NOT_NULL);assertNotNull(m.getMap("c"));diff --git a/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java b/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.javaindex c3bfbed295b..24a7ea596c5 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java@@ -27,7 +27,6 @@ import org.apache.solr.SolrTestCaseJ4;public class Utf8CharSequenceTest extends SolrTestCaseJ4 {- @SuppressWarnings({"unchecked"})public void testLargeString() throws IOException {StringBuilder sb = new StringBuilder();for (int i = 0; i < 100; i++) {@@ -49,8 +48,7 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {utf81 = new ByteArrayUtf8CharSequence(result, 0, result.length);assertTrue(utf81.equals(utf8));- @SuppressWarnings({"rawtypes"})- Map m0 = new HashMap();+ Map<String, Object> m0 = new HashMap<>();m0.put("str", utf8);baos.reset();try (JavaBinCodec jbc = new JavaBinCodec()) {@@ -58,8 +56,7 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {}result = baos.toByteArray();try (JavaBinCodec jbc = new JavaBinCodec()) {- @SuppressWarnings({"rawtypes"})- Map m1 = (Map) jbc+ Map<?,?> m1 = (Map<?,?>) jbc.setReadStringAsCharSeq(true).unmarshal(new ByteArrayInputStream(result));utf81 = (ByteArrayUtf8CharSequence) m1.get("str");@@ -67,10 +64,8 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {}}- @SuppressWarnings({"unchecked"})public void testUnMarshal() throws IOException {- @SuppressWarnings({"rawtypes"})- NamedList nl = new NamedList();+ NamedList<String> nl = new NamedList<>();String str = " The value!";for (int i = 0; i < 5; i++) {StringBuffer sb = new StringBuffer();@@ -93,10 +88,9 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {}byte[] bytes = baos.toByteArray();- @SuppressWarnings({"rawtypes"})- NamedList nl1;+ NamedList<?> nl1;try (JavaBinCodec jbc = new JavaBinCodec()) {- nl1 = (NamedList) jbc+ nl1 = (NamedList<?>) jbc.setReadStringAsCharSeq(true).unmarshal(new ByteArrayInputStream(bytes, 0, bytes.length));}diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.javaindex 3fb48d9cb9b..6d45c05afe6 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java@@ -170,6 +170,7 @@ import static org.apache.solr.cloud.SolrZkServer.ZK_WHITELIST_PROPERTY;import static org.apache.solr.common.cloud.ZkStateReader.URL_SCHEME;import static org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;+import static org.hamcrest.core.StringContains.containsString;/*** A junit4 Solr test harness that extends SolrTestCase and, by extension, LuceneTestCase.@@ -227,6 +228,17 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {}}+ protected void assertExceptionThrownWithMessageContaining(Class<? extends Throwable> expectedType,+ List<String> expectedStrings, ThrowingRunnable runnable) {+ Throwable thrown = expectThrows(expectedType, runnable);++ if (expectedStrings != null) {+ for (String expectedString : expectedStrings) {+ assertThat(thrown.getMessage(), containsString(expectedString));+ }+ }+ }+/*** Annotation for test classes that want to disable SSL*/