<font size=2 face="sans-serif">Thank you Martin for the info! It is strange
that the application works on OWB</font><br><br><font size=2 face="sans-serif">Many thanks,<br>Emily<br>===========================<br>Emily Jiang<br>WebSphere Application Server, CDI Development Lead</font><br><font size=2 face="sans-serif"> <br>MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>Phone: +44 (0)1962 816278 Internal: 246278<br><br>Email: emijiang@uk.ibm.com <br>Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br></font><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Martin Kouba <mkouba@redhat.com></font><br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Emily Jiang/UK/IBM@IBMGB,
</font><br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">Weld <weld-dev@lists.jboss.org></font><br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">03/12/2015 08:27</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [weld-dev]
Overridden equals() are ignored on client proxy</font><br><font size=1 color=#5f5f5f face="sans-serif">Sent by:
</font><font size=1 face="sans-serif">weld-dev-bounces@lists.jboss.org</font><br><hr noshade><br><br><br><tt><font size=2>Hi Emily,<br><br>yes, the spec is clear and for good reasons. This was already discussed
<br>in EG and weld community - see for example WELD-695 [1]. And the <br>consensus is: "it does not make sense to delegate equals/hashcode
to <br>bean instances for client proxies".<br><br>One of the problems is that client proxies may be shared between <br>multiple injection points (and in Weld they are).<br><br>Also in Weld a client proxy is equal to a client proxy for the same bean.<br><br>Anyway, it seems it doesn't work on OWB either - see also OWB-458 [2].<br><br>Martin<br><br><br>[1]<br></font></tt><a href="https://issues.jboss.org/browse/WELD-695?focusedCommentId=12566720&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12566720"><tt><font size=2>https://issues.jboss.org/browse/WELD-695?focusedCommentId=12566720&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12566720</font></tt></a><tt><font size=2><br><br>[2]<br></font></tt><a href="https://issues.apache.org/jira/browse/OWB-458"><tt><font size=2>https://issues.apache.org/jira/browse/OWB-458</font></tt></a><tt><font size=2><br><br>Dne 3.12.2015 v 00:43 Emily Jiang napsal(a):<br>> Hi Martin,<br>><br>> For some reason, a proxied bean's equals cannot be called. Are you
aware<br>> of this problem? Although the spec says:<br>><br>> The behavior of all methods declared by java.lang.Object, except for<br>> toString(), is<br>> undefined for a client proxy. Portable applications should not invoke<br>> any method declared by<br>> java.lang.Object, except for toString(), on a client proxy.<br>><br>> I thought the overridden equals is different from the methods defined
by<br>> Object class and it should be invoked.<br>><br>> Please find attached a very simple test case that shows a .equals()<br>> method not being invoked on a bean proxied by Weld.<br>><br>><br>> In a debugger one can see that GenericBean.equals() is not invoked<br>> within the Servlet:<br>><br>> protected void doGet(HttpServletRequest
request,<br>> HttpServletResponse response) throws ServletException, IOException
{<br>> PrintWriter pw = response.getWriter();<br>> pw.println ("Hello");<br>> if (gb.equals(new GenericBean(10))) { //
GenericBean.equals() is<br>> not invoked; test prints 'fail'<br>> pw.println("pass");<br>> } else {<br>> pw.println
("fail");<br>> }<br>> }<br>><br>> The .war contains source and object code. As you can see there's only<br>> two classes.<br>><br>> Many thanks,<br>> Emily<br>> ===========================<br>> Emily Jiang<br>> WebSphere Application Server, CDI Development Lead<br>><br>> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>> Phone: +44 (0)1962 816278 Internal: 246278<br>><br>> Email: emijiang@uk.ibm.com<br>> Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>> Unless stated otherwise above:<br>> IBM United Kingdom Limited - Registered in England and Wales with
number<br>> 741598.<br>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>><br><br>-- <br>Martin Kouba<br>Software Engineer<br>Red Hat, Czech Republic<br>_______________________________________________<br>weld-dev mailing list<br>weld-dev@lists.jboss.org<br></font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><br><br></font></tt><br><BR>