commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Created] (CODEC-141) Generics warnings for StringEncoderComparator
Date Thu, 03 May 2012 10:48:50 GMT
Sebb created CODEC-141:

             Summary: Generics warnings for StringEncoderComparator
                 Key: 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:!default.jspa
For more information on JIRA, see:


View raw message