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

Mark Struberg reassigned OWB-1233:
----------------------------------

    Assignee: Mark Struberg

> WrappedValueExpression.equals(Object arg0) always false if arg0 is an 
> instance of WrappedValueExpression
> --------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-1233
>                 URL: https://issues.apache.org/jira/browse/OWB-1233
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Enterprise Web Beans
>    Affects Versions: 2.0.3
>            Reporter: Holger Sunke
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 2.0.5
>
>
> Hello,
>  
> I found that _org.apache.webbeans.el22.WrappedValueExpression.equals(Object 
> arg0)_ does not consider that arg0 might also bee an instance of 
> WrappedValueExpression always returns _false_ in this case.
>  
> Reproduce:
>  # Create two equal org.apache.el.ValueExpressionImpl instances _ve1_ and 
> _ve2_ such that ve1.equals(ve2) is true.
>  # Wrap _ve1_ with _we1_ = new WrappedValueExpression(_ve1_);
>  # Wrap _ve2_ with _we2_ = new WrappedValueExpression(_ve2_);
>  # assertTrue(we1.equals(we2)); -> fails
>  # assertTrue(we1.equals(ve2)); -> succeeds
>  # assertTrue(we1.equals(we1)); -> fails
>  # assertTrue(we1.equals(ve1)); -> succeeds
>  # assertTrue(ve2.equals(we1)); -> fails, breaking symmetry rule with (5.)
>  # assertTrue(ve1.equals(we1)); -> fails, breaking symmetry rule with (7.)
> I'd expect all assertions to succeed in accordance to the contract as 
> described in documentation of java.lang.Object.equals(Object).
>  
> Btw: isn't it quite dangerous to rely on the hashCode() only in 
> ValueExpressionImpl.equals(Object)?
> public boolean equals(Object obj) {
>         return (obj instanceof ValueExpressionImpl && obj.hashCode() == this
>                 .hashCode());
>  }



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

Reply via email to