Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -216,7 +217,7 @@ public void finishStage(ResponseBuilder rb) {

Map.Entry<String, Object>[] arr =
(Map.Entry<String, Object>[])
Array.newInstance(NamedList.NamedListEntry.class, rb.resultIds.size());
Array.newInstance(AbstractMap.SimpleEntry.class, rb.resultIds.size());
// Will be set to true if there is at least one response with PURPOSE_GET_DEBUG
boolean hasGetDebugResponses = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -260,7 +261,7 @@ protected Object convertHighlights(NamedList<Object> hl) {
protected Object[] newHighlightsArray(int size) {
// Curious why this doesn't trigger an unchecked cast, but maybe the compiler is smart enough to
// know
return (Object[]) Array.newInstance(NamedList.NamedListEntry.class, size);
return (Object[]) Array.newInstance(AbstractMap.SimpleEntry.class, size);
}

protected void addHighlights(Object[] objArr, Object obj, Map<Object, ShardDoc> resultIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
Expand Down Expand Up @@ -421,8 +422,8 @@ public void finishStage(ResponseBuilder rb) {

@SuppressWarnings("unchecked")
Map.Entry<String, Object>[] arr =
(NamedList.NamedListEntry<Object>[])
Array.newInstance(NamedList.NamedListEntry.class, rb.resultIds.size());
(Map.Entry<String, Object>[])
Array.newInstance(AbstractMap.SimpleEntry.class, rb.resultIds.size());

for (ShardRequest sreq : rb.finished) {
if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) == 0
Expand Down
3 changes: 2 additions & 1 deletion solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.lang.invoke.MethodHandles;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -825,7 +826,7 @@ public static void copyNamedListIntoArrayByDocPosInResponse(
ShardDoc sdoc = resultIds.get(id);
if (sdoc != null) { // maybe null when rb.onePassDistributedQuery
int idx = sdoc.positionInResponse;
destArr[idx] = new NamedList.NamedListEntry<>(id, val);
destArr[idx] = new AbstractMap.SimpleEntry<>(id, val);
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import java.util.List;
import java.util.Map;

@Deprecated // see NavigableMap.wrap. May keep but use package scope.
public class MapWriterMap implements MapWriter {
/** Wraps a {@link Map} as a {@link MapWriter}; obtain via {@link NavigableObject#wrap(Object)}. */
class MapWriterMap implements MapWriter {
private final Map<String, Object> delegate;

public MapWriterMap(Map<String, Object> delegate) {
MapWriterMap(Map<String, Object> delegate) {
this.delegate = delegate;
}

Expand Down
12 changes: 0 additions & 12 deletions solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.IOException;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -501,17 +500,6 @@ public SolrParams toSolrParams() {
return new MultiMapSolrParams(map);
}

/**
* Helper class implementing Map.Entry&lt;String, T&gt; to store the key-value relationship in
* NamedList (the keys of which are String-s)
*/
@Deprecated // use AbstractMap.SimpleEntry or Map.entry() (albeit no nulls)
public static final class NamedListEntry<T> extends AbstractMap.SimpleEntry<String, T> {
public NamedListEntry(String _key, T _value) {
super(_key, _value);
}
}

/** Iterates over the Map and sequentially adds its key/value pairs */
public boolean addAll(Map<String, T> args) {
for (Map.Entry<String, T> entry : args.entrySet()) {
Expand Down