[jira] Created: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

ASF GitHub Bot (Jira)
Fraction.hashCode() inconsistent with Fraction.equals()
-------------------------------------------------------

                 Key: MATH-335
                 URL: https://issues.apache.org/jira/browse/MATH-335
             Project: Commons Math
          Issue Type: Bug
            Reporter: Sebb
            Priority: Minor


Fraction.hashCode() is inconsistent with Fraction.equals().

hashCode() uses getNumerator() (which is not final) rather than directly accessing the field.

Seems to me that hashCode() has no reason to use the getters - or if it does, then equals should do so too.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

ASF GitHub Bot (Jira)

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

Luc Maisonobe commented on MATH-335:
------------------------------------

Agreed. I would prefer it uses the fields directly.

> Fraction.hashCode() inconsistent with Fraction.equals()
> -------------------------------------------------------
>
>                 Key: MATH-335
>                 URL: https://issues.apache.org/jira/browse/MATH-335
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>
> Fraction.hashCode() is inconsistent with Fraction.equals().
> hashCode() uses getNumerator() (which is not final) rather than directly accessing the field.
> Seems to me that hashCode() has no reason to use the getters - or if it does, then equals should do so too.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated MATH-335:
-----------------------------

    Fix Version/s: 2.1

> Fraction.hashCode() inconsistent with Fraction.equals()
> -------------------------------------------------------
>
>                 Key: MATH-335
>                 URL: https://issues.apache.org/jira/browse/MATH-335
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 2.1
>
>
> Fraction.hashCode() is inconsistent with Fraction.equals().
> hashCode() uses getNumerator() (which is not final) rather than directly accessing the field.
> Seems to me that hashCode() has no reason to use the getters - or if it does, then equals should do so too.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved MATH-335.
-----------------------

    Resolution: Fixed

URL: http://svn.apache.org/viewvc?rev=922715&view=rev
Log:
MATH-335 Fraction.hashCode() inconsistent with Fraction.equals()
Change hashCode() to use fields directly


> Fraction.hashCode() inconsistent with Fraction.equals()
> -------------------------------------------------------
>
>                 Key: MATH-335
>                 URL: https://issues.apache.org/jira/browse/MATH-335
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 2.1
>
>
> Fraction.hashCode() is inconsistent with Fraction.equals().
> hashCode() uses getNumerator() (which is not final) rather than directly accessing the field.
> Seems to me that hashCode() has no reason to use the getters - or if it does, then equals should do so too.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (MATH-335) Fraction.hashCode() inconsistent with Fraction.equals()

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz closed MATH-335.
----------------------------


> Fraction.hashCode() inconsistent with Fraction.equals()
> -------------------------------------------------------
>
>                 Key: MATH-335
>                 URL: https://issues.apache.org/jira/browse/MATH-335
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 2.1
>
>
> Fraction.hashCode() is inconsistent with Fraction.equals().
> hashCode() uses getNumerator() (which is not final) rather than directly accessing the field.
> Seems to me that hashCode() has no reason to use the getters - or if it does, then equals should do so too.

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