[jira] Created: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

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

[jira] Created: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Gary D. Gregory (Jira)
mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
-----------------------------------------------------------------------------------------

                 Key: LANG-630
                 URL: https://issues.apache.org/jira/browse/LANG-630
             Project: Commons Lang
          Issue Type: Bug
            Reporter: Sebb
             Fix For: 3.0


FIndbugs:

mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method.


--
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: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/LANG-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884945#action_12884945 ]

Sean Mickey commented on LANG-630:
----------------------------------

It seems like the best option is replacing the equals(MutableObject) with equals(Object). It simplifies the code, refactors  to what most developers expect, and the minor overhead associated calling intanceof is worth the improvement in the code.

The equality check is very simple and the hashCode operation will not have to change. Just making sure I'm not missing something before I give this a go.

> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method.

--
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: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Sean Mickey updated LANG-630:
-----------------------------

    Attachment: MutableObject-equals.txt

The attached patch file addresses this bug. MutableObject.equals(MutableObject) has been refactored to MutableObject.equals(Object). There are also some minor javadoc cleanups and a little more javadoc information has been added.

No changes to MutableObject.hashCode were necessary.

MutableObjectTest.java verifies that equals continues to work correctly and also that hashCode continues to work correctly. All unit tests ran successfully.

> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: MutableObject-equals.txt
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method.

--
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: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Henri Yandell closed LANG-630.
------------------------------

    Resolution: Fixed

Thanks Sean.

svn ci -m "Applying Sean Mickey's patch to LANG-630 such that MutableObject.equals is as would be expected. Now it directly overrides the equals(Object) method. " src/main/java/org/apache/commons/lang3/mutable/
Sending        src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
Transmitting file data .
Committed revision 965162.


> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: MutableObject-equals.txt
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method.

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