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



##########
File path: 
solr/solrj/src/java/org/apache/solr/client/solrj/io/ClassificationEvaluation.java
##########
@@ -36,28 +36,26 @@ public void count(int actual, int predicted) {
     }
   }
 
-  @SuppressWarnings({"unchecked"})
-  public void putToMap(@SuppressWarnings({"rawtypes"})Map map) {
+  public void putToMap(Map<? super String, ? super Long> map) {
     map.put("truePositive_i",truePositive);
     map.put("trueNegative_i",trueNegative);
     map.put("falsePositive_i",falsePositive);
     map.put("falseNegative_i",falseNegative);
   }
 
-  @SuppressWarnings({"rawtypes"})
-  public Map toMap() {
-    HashMap map = new HashMap();
+  public Map<String, Long> toMap() {
+    HashMap<String, Long> map = new HashMap<>();
     putToMap(map);
     return map;
   }
 
-  public static ClassificationEvaluation 
create(@SuppressWarnings({"rawtypes"})Map map) {
+  public static ClassificationEvaluation create(Map<String, ?> map) {
     ClassificationEvaluation evaluation = new ClassificationEvaluation();
     evaluation.addEvaluation(map);
     return evaluation;
   }
 
-  public void addEvaluation(@SuppressWarnings({"rawtypes"})Map map) {
+  public void addEvaluation(Map<String, ?> map) {

Review comment:
       Following up on the earlier comment about PECS, this map is a producer, 
not a consumer, so we don't care about making sure that it can accept Long. 
We're kind of dancing on a sharp edge here where we cast things to longs from 
?, but we don't know what's in the Map and we're not putting anything new in it 
so we're ok. If there's an assumption violated about data types here, then 
we'll throw an exception and that's probably the best we can do regardless.




-- 
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:
us...@infra.apache.org



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

Reply via email to