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



##########
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() {

Review comment:
       `putToMap` has `Map<? super String, ? super Long>` and I wonder if 
`toMap` could have `Map<? super String, ? super Long>` return type then to 
match? Though for either I struggle to see why one might want to use something 
other than `Map<String, Long>` here i.e. why someone might pass something else 
to `putToMap` or to override the `toMap` method to return something else.

##########
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:
       ```suggestion
     public void addEvaluation(Map<String, ? super Long> map) {
   ```

##########
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) {

Review comment:
       ```suggestion
     public static ClassificationEvaluation create(Map<String, ? super Long> 
map) {
   ```




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to