commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-261) Add generics to Frequency
Date Tue, 14 Apr 2009 21:01:15 GMT

    [ https://issues.apache.org/jira/browse/MATH-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698927#action_12698927
] 

Sebb commented on MATH-261:
---------------------------

Re removing @SuppressWarnings:
The (T) casts cannot be removed from the obj parameter - the code won't compile.

Not sure why the compiler is objecting to the "instanceof " check and the (Integer) cast -
seems like a bug to me.

Regarding type "mixing": yes, I was trying to preserve the existing (documented) behaviour
as far as possible. That was the whole point.
It would be possible to treat Long and Integer as Objects, and that would simplify the class.

But what about primitive types - should long and int and short be comparable? Or should they
all be treated separately?
That is a separate discussion, which is probably better dealt with on the mailing list.

AFAICT, the only change is to insist that the Objects added to the class implement Comparable.
That was true previously, except for the trivial case of adding a single object - but then
the getXXX methods could fail to return sensible values, see MATH-259.
It was never possible to add two items unless they were both Comparable and also Comparable
to each other.
I don't think that has changed - if you have a test case that worked previously and now fails,
please add it.

> Add generics to Frequency
> -------------------------
>
>                 Key: MATH-261
>                 URL: https://issues.apache.org/jira/browse/MATH-261
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Sebb
>             Fix For: 2.0
>
>         Attachments: Frequency.patch
>
>
> I've attempted to add generics to Frequency.
> This requires a minor change to the API, in that Objects to be used with the class need
to be Comparable.
> This will break some code, e.g. one change was needed to the test cases.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message