Sebb created CODEC-141:
--------------------------

             Summary: Generics warnings for StringEncoderComparator
                 Key: CODEC-141
                 URL: https://issues.apache.org/jira/browse/CODEC-141
             Project: Commons Codec
          Issue Type: Bug
            Reporter: Sebb
         Attachments: CODEC-141.patch

The StringEncoderComparator class currently extends the raw type Comparator.

I think it should extend Comparator<Object>, as it implements compare(Object, 
Object).

Although it is documented as being a String comparator, some StringEncoder 
implementations also support other types such as byte[].

Secondly, its compare() method currently casts the stringEncoder.encode() 
results to Comparable.
This might as well be String, as that is what a StringEncoder is supposed to do.
If a class cast exception occurs, then this is a bug in the provided 
StringEncoder (and casting to Comparable would likely also fail).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to