[jira] [Commented] (OFBIZ-9738) ShoppingCartItem equals method does not compare object references

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-9738) ShoppingCartItem equals method does not compare object references

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-9738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16726666#comment-16726666 ]

Gareth Carter commented on OFBIZ-9738:
--------------------------------------

Hi Saurabh

*There is also an equals method which takes a ShoppingCartItem object and do the comparison with the other ShoppingCartItem object which I think fulfills your purpose.* - this method does not reference check, it only compares some of the internal fields - which does not follow best practices. I don't know the reasoning behind this but it does not make sense (javadoc would of helped!), I would recommend to change either equals(ShoppingCartItem item) to altleast reference check or remove the method and override equals(Object obj) in the correct way

> ShoppingCartItem equals method does not compare object references
> -----------------------------------------------------------------
>
>                 Key: OFBIZ-9738
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9738
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Trunk
>            Reporter: Gareth Carter
>            Assignee: Saurabh Dixit
>            Priority: Minor
>
> The default Object class equals method checks for reference equality however ShoppingCartItem does not (I believe it should). When it filters down through the other equals methods some properties have a default value which could be different to the value stored in the object



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)