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 f9f5abf21e9 SOLR-17600: MapSerializable p4: Delete MapSerializable
(#4466)
f9f5abf21e9 is described below
commit f9f5abf21e972afc67121af36640eec7ac5c63b4
Author: Ivan Šarić <[email protected]>
AuthorDate: Sun Jun 21 06:23:27 2026 +0200
SOLR-17600: MapSerializable p4: Delete MapSerializable (#4466)
MapSerializable is deprecated; stop using it in some places.
---
changelog/unreleased/SOLR-17600.yml | 7 +++++
.../org/apache/solr/common/MapSerializable.java | 33 ----------------------
.../org/apache/solr/common/util/JavaBinCodec.java | 6 ----
.../org/apache/solr/common/util/TextWriter.java | 5 ----
4 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/changelog/unreleased/SOLR-17600.yml
b/changelog/unreleased/SOLR-17600.yml
new file mode 100644
index 00000000000..e89a7090742
--- /dev/null
+++ b/changelog/unreleased/SOLR-17600.yml
@@ -0,0 +1,7 @@
+title: Replace MapSerializable with MapWriter
+type: other
+authors:
+ - name: Ivan Šarić
+links:
+ - name: SOLR-17600
+ url: https://issues.apache.org/jira/browse/SOLR-17600
diff --git a/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
b/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
deleted file mode 100644
index e5d6ebafa92..00000000000
--- a/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.common;
-
-import java.util.Map;
-
-/**
- * This is to facilitate just in time creation of objects before writing it to
the response.
- *
- * @deprecated Use {@link MapWriter} instead
- */
-@Deprecated
-public interface MapSerializable {
- /**
- * Use the passed map to minimize object creation. Do not keep a reference
to the passed map and
- * reuse it. it may be reused by the framework
- */
- Map<String, Object> toMap(Map<String, Object> map);
-}
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.java
index dc47f5aa67d..63e6613ae25 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
@@ -47,7 +47,6 @@ import org.apache.solr.common.ConditionalKeyMapWriter;
import org.apache.solr.common.EnumFieldValue;
import org.apache.solr.common.IteratorWriter;
import org.apache.solr.common.IteratorWriter.ItemWriter;
-import org.apache.solr.common.MapSerializable;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.PushWriter;
import org.apache.solr.common.SolrDocument;
@@ -428,11 +427,6 @@ public class JavaBinCodec implements PushWriter {
writeMapEntry((Map.Entry) val);
return true;
}
- if (val instanceof MapSerializable) {
- // todo find a better way to reuse the map more efficiently
- writeMap(((MapSerializable) val).toMap(new NamedList().asShallowMap()));
- return true;
- }
if (val instanceof AtomicInteger) {
writeInt(((AtomicInteger) val).get());
return true;
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.java
index 6901b2db5ed..ea50ab8bbbc 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
@@ -27,7 +27,6 @@ import java.util.Base64;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -38,7 +37,6 @@ import java.util.concurrent.atomic.LongAdder;
import org.apache.solr.client.api.util.ReflectWritable;
import org.apache.solr.common.EnumFieldValue;
import org.apache.solr.common.IteratorWriter;
-import org.apache.solr.common.MapSerializable;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.PushWriter;
@@ -89,9 +87,6 @@ public interface TextWriter extends PushWriter {
writeMap(name, (MapWriter) val);
} else if (val instanceof ReflectWritable) {
writeVal(name, Utils.getReflectWriter(val));
- } else if (val instanceof MapSerializable) {
- // todo find a better way to reuse the map more efficiently
- writeMap(name, ((MapSerializable) val).toMap(new LinkedHashMap<>()),
false, true);
} else if (val instanceof Map) {
writeMap(name, (Map) val, false, true);
} else if (val instanceof Collection<?> cval) { // very generic; keep
towards the end