You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/07/15 20:26:40 UTC

[GitHub] [solr] madrob commented on a change in pull request #216: SOLR-15535: remove rawtypes warnings in 'grouping' code

madrob commented on a change in pull request #216:
URL: https://github.com/apache/solr/pull/216#discussion_r669161015



##########
File path: solr/core/src/java/org/apache/solr/search/grouping/distributed/command/SearchGroupsFieldCommand.java
##########
@@ -123,14 +123,15 @@ private SearchGroupsFieldCommand(SchemaField field, Sort groupSort, int topNGrou
   }
 
   @Override
-  @SuppressWarnings({"unchecked"})
+  @SuppressWarnings("unchecked")
   public SearchGroupsFieldCommandResult result() throws IOException {
     final Collection<SearchGroup<BytesRef>> topGroups;
     if (firstPassGroupingCollector != null) {
+      Collection<?> values = (Collection<?>) firstPassGroupingCollector.getTopGroups(0);

Review comment:
       My IDE tells me this is a redundant cast?

##########
File path: solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/SearchGroupsResultTransformer.java
##########
@@ -85,7 +85,9 @@ public SearchGroupsResultTransformer(SolrIndexSearcher searcher) {
         searchGroup.groupValue = new BytesRef(groupValue);
       }
     }
-    searchGroup.sortValues = rawSearchGroupData.toArray(new Comparable[rawSearchGroupData.size()]);
+    @SuppressWarnings("unchecked")
+    Comparable<?>[] sv = (Comparable<?>[]) Array.newInstance(Comparable.class, rawSearchGroupData.size());

Review comment:
       I think you can do this, but I can't find a JLS reference for why it works.
   ```suggestion
       Comparable<?>[] sv = new Comparable<?>[rawSearchGroupData.size()];
   ```




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

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



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