You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:07:49 UTC

[GitHub] [lucene-solr] ErickErickson commented on a change in pull request #1556: SOLR-8392 type safety on SolrParam

ErickErickson commented on a change in pull request #1556:
URL: https://github.com/apache/lucene-solr/pull/1556#discussion_r436978229



##########
File path: solr/core/src/java/org/apache/solr/core/RequestParams.java
##########
@@ -85,32 +85,25 @@ public static ParamSet createParamSet(Map map, Long version) {
    * This converts Lists to arrays of strings. Because Solr expects
    * params to be String[]
    */
-
-  @SuppressWarnings({"unchecked", "rawtypes"})
-  private static Map getMapCopy(Map value) {
-    @SuppressWarnings({"rawtypes"})
-    Map copy = new LinkedHashMap<>();
-    for (Object o1 : value.entrySet()) {
-      @SuppressWarnings({"rawtypes"})
-      Map.Entry entry = (Map.Entry) o1;
+  private static Map<String,String[]> getMapCopy(Map<String,?> value) {
+    Map<String, String[]> copy = new LinkedHashMap<>();
+    for (Map.Entry<String, ?> entry : value.entrySet()) {
       if ("".equals(entry.getKey())) {
-        copy.put(entry.getKey(), entry.getValue());
-        continue;
+        // nocommit
+        // copy.put(entry.getKey(), entry.getValue());

Review comment:
       This smells badly. If the key is "", then the raw value would be put in the return in the old code, even if null, whereas the changed code if the value was NOT null, it'd be the entry.getValue().toString() rather than entry.getValue().
   
   That said, I think the change is better and any place in the that relies on the old behavior should be fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org