You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Gareth Carter (JIRA)" <ji...@apache.org> on 2018/12/21 11:19:00 UTC

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

    [ 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)