This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new a12904d5476 SOLR-18374: remove NamedList.NamedListEntry, scope
MapWriterMap to its package (#4763)
a12904d5476 is described below
commit a12904d547697c8f9ed47e1e7902484f1f7d3451
Author: Serhiy Bzhezytskyy <[email protected]>
AuthorDate: Sun Aug 23 20:46:06 2026 +0300
SOLR-18374: remove NamedList.NamedListEntry, scope MapWriterMap to its
package (#4763)
---
.../org/apache/solr/handler/component/DebugComponent.java | 3 ++-
.../apache/solr/handler/component/HighlightComponent.java | 3 ++-
.../apache/solr/handler/component/TermVectorComponent.java | 5 +++--
solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java | 3 ++-
solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java | 6 +++---
.../src/java/org/apache/solr/common/util/NamedList.java | 12 ------------
6 files changed, 12 insertions(+), 20 deletions(-)
diff --git
a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
index 70dd1a401f2..ff599f52d7d 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
@@ -22,6 +22,7 @@ import static org.apache.solr.common.params.CommonParams.JSON;
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;
@@ -216,7 +217,7 @@ public class DebugComponent extends SearchComponent {
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;
diff --git
a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
index 99f02dcf955..a072a5640a2 100644
---
a/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
+++
b/solr/core/src/java/org/apache/solr/handler/component/HighlightComponent.java
@@ -18,6 +18,7 @@ package org.apache.solr.handler.component;
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;
@@ -260,7 +261,7 @@ public class HighlightComponent extends SearchComponent
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) {
diff --git
a/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
b/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
index a4702e1d613..7252adc17dd 100644
---
a/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
+++
b/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
@@ -20,6 +20,7 @@ import java.io.IOException;
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;
@@ -421,8 +422,8 @@ public class TermVectorComponent extends SearchComponent {
@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
diff --git a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
index ed6178be4f9..43bf2ee3b11 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
@@ -29,6 +29,7 @@ import java.io.IOException;
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;
@@ -825,7 +826,7 @@ public class SolrPluginUtils {
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);
}
});
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java
b/solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java
index 454898afc11..a2e084a5ba6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java
+++ b/solr/solrj/src/java/org/apache/solr/common/MapWriterMap.java
@@ -21,11 +21,11 @@ import java.io.IOException;
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;
}
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.java
index e4f27c4025b..f13a71f8723 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
@@ -18,7 +18,6 @@ package org.apache.solr.common.util;
import java.io.IOException;
import java.io.Serializable;
-import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -501,17 +500,6 @@ public class NamedList<T>
return new MultiMapSolrParams(map);
}
- /**
- * Helper class implementing Map.Entry<String, T> 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()) {