Apache Solr open-source search software
SOLR-17600: MapSerializable p4: Delete MapSerializable (#4466)
Ivan Šarićf9f5abf21e97
diff --git a/changelog/unreleased/SOLR-17600.yml b/changelog/unreleased/SOLR-17600.ymlnew file mode 100644index 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-17600diff --git a/solr/solrj/src/java/org/apache/solr/common/MapSerializable.java b/solr/solrj/src/java/org/apache/solr/common/MapSerializable.javadeleted file mode 100644index 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.javaindex 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.javaindex 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