From EMIJIANG at uk.ibm.com Wed Dec 2 18:43:22 2015 From: EMIJIANG at uk.ibm.com (Emily Jiang) Date: Wed, 2 Dec 2015 23:43:22 +0000 Subject: [weld-dev] Overridden equals() are ignored on client proxy Message-ID: <201512022344.tB2NiFDu001883@d06av04.portsmouth.uk.ibm.com> Hi Martin, For some reason, a proxied bean's equals cannot be called. Are you aware of this problem? Although the spec says: The behavior of all methods declared by java.lang.Object, except for toString(), is undefined for a client proxy. Portable applications should not invoke any method declared by java.lang.Object, except for toString(), on a client proxy. I thought the overridden equals is different from the methods defined by Object class and it should be invoked. Please find attached a very simple test case that shows a .equals() method not being invoked on a bean proxied by Weld. In a debugger one can see that GenericBean.equals() is not invoked within the Servlet: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter pw = response.getWriter(); pw.println ("Hello"); if (gb.equals(new GenericBean(10))) { // GenericBean.equals() is not invoked; test prints 'fail' pw.println("pass"); } else { pw.println ("fail"); } } The .war contains source and object code. As you can see there's only two classes. Many thanks, Emily =========================== Emily Jiang WebSphere Application Server, CDI Development Lead MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN Phone: +44 (0)1962 816278 Internal: 246278 Email: emijiang at uk.ibm.com Lotus Notes: Emily Jiang/UK/IBM at IBMGB Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20151202/7d96d6aa/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cdiEquals.war Type: application/octet-stream Size: 3464 bytes Desc: not available Url : http://lists.jboss.org/pipermail/weld-dev/attachments/20151202/7d96d6aa/attachment-0001.obj From mkouba at redhat.com Thu Dec 3 03:26:27 2015 From: mkouba at redhat.com (Martin Kouba) Date: Thu, 3 Dec 2015 09:26:27 +0100 Subject: [weld-dev] Overridden equals() are ignored on client proxy In-Reply-To: <201512022344.tB2NiFXO008847@d06av06.portsmouth.uk.ibm.com> References: <201512022344.tB2NiFXO008847@d06av06.portsmouth.uk.ibm.com> Message-ID: <565FFCB3.40406@redhat.com> Hi Emily, yes, the spec is clear and for good reasons. This was already discussed in EG and weld community - see for example WELD-695 [1]. And the consensus is: "it does not make sense to delegate equals/hashcode to bean instances for client proxies". One of the problems is that client proxies may be shared between multiple injection points (and in Weld they are). Also in Weld a client proxy is equal to a client proxy for the same bean. Anyway, it seems it doesn't work on OWB either - see also OWB-458 [2]. Martin [1] https://issues.jboss.org/browse/WELD-695?focusedCommentId=12566720&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12566720 [2] https://issues.apache.org/jira/browse/OWB-458 Dne 3.12.2015 v 00:43 Emily Jiang napsal(a): > Hi Martin, > > For some reason, a proxied bean's equals cannot be called. Are you aware > of this problem? Although the spec says: > > The behavior of all methods declared by java.lang.Object, except for > toString(), is > undefined for a client proxy. Portable applications should not invoke > any method declared by > java.lang.Object, except for toString(), on a client proxy. > > I thought the overridden equals is different from the methods defined by > Object class and it should be invoked. > > Please find attached a very simple test case that shows a .equals() > method not being invoked on a bean proxied by Weld. > > > In a debugger one can see that GenericBean.equals() is not invoked > within the Servlet: > > protected void doGet(HttpServletRequest request, > HttpServletResponse response) throws ServletException, IOException { > PrintWriter pw = response.getWriter(); > pw.println ("Hello"); > if (gb.equals(new GenericBean(10))) { // GenericBean.equals() is > not invoked; test prints 'fail' > pw.println("pass"); > } else { > pw.println ("fail"); > } > } > > The .war contains source and object code. As you can see there's only > two classes. > > Many thanks, > Emily > =========================== > Emily Jiang > WebSphere Application Server, CDI Development Lead > > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN > Phone: +44 (0)1962 816278 Internal: 246278 > > Email: emijiang at uk.ibm.com > Lotus Notes: Emily Jiang/UK/IBM at IBMGB > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > -- Martin Kouba Software Engineer Red Hat, Czech Republic From mkouba at redhat.com Mon Dec 7 03:35:06 2015 From: mkouba at redhat.com (Martin Kouba) Date: Mon, 7 Dec 2015 09:35:06 +0100 Subject: [weld-dev] Weld 3.0.0.Alpha14 released Message-ID: <566544BA.50309@redhat.com> http://weld.cdi-spec.org/news/2015/12/04/weld-300Alpha14/ -- Martin Kouba Software Engineer Red Hat, Czech Republic From EMIJIANG at uk.ibm.com Wed Dec 9 05:01:19 2015 From: EMIJIANG at uk.ibm.com (Emily Jiang) Date: Wed, 9 Dec 2015 10:01:19 +0000 Subject: [weld-dev] Overridden equals() are ignored on client proxy In-Reply-To: <565FFCB3.40406@redhat.com> References: <201512022344.tB2NiFXO008847@d06av06.portsmouth.uk.ibm.com> <565FFCB3.40406@redhat.com> Message-ID: <201512091001.tB9A1QsG023701@d06av06.portsmouth.uk.ibm.com> Thank you Martin for the info! It is strange that the application works on OWB Many thanks, Emily =========================== Emily Jiang WebSphere Application Server, CDI Development Lead MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN Phone: +44 (0)1962 816278 Internal: 246278 Email: emijiang at uk.ibm.com Lotus Notes: Emily Jiang/UK/IBM at IBMGB From: Martin Kouba To: Emily Jiang/UK/IBM at IBMGB, Cc: Weld Date: 03/12/2015 08:27 Subject: Re: [weld-dev] Overridden equals() are ignored on client proxy Sent by: weld-dev-bounces at lists.jboss.org Hi Emily, yes, the spec is clear and for good reasons. This was already discussed in EG and weld community - see for example WELD-695 [1]. And the consensus is: "it does not make sense to delegate equals/hashcode to bean instances for client proxies". One of the problems is that client proxies may be shared between multiple injection points (and in Weld they are). Also in Weld a client proxy is equal to a client proxy for the same bean. Anyway, it seems it doesn't work on OWB either - see also OWB-458 [2]. Martin [1] https://issues.jboss.org/browse/WELD-695?focusedCommentId=12566720&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12566720 [2] https://issues.apache.org/jira/browse/OWB-458 Dne 3.12.2015 v 00:43 Emily Jiang napsal(a): > Hi Martin, > > For some reason, a proxied bean's equals cannot be called. Are you aware > of this problem? Although the spec says: > > The behavior of all methods declared by java.lang.Object, except for > toString(), is > undefined for a client proxy. Portable applications should not invoke > any method declared by > java.lang.Object, except for toString(), on a client proxy. > > I thought the overridden equals is different from the methods defined by > Object class and it should be invoked. > > Please find attached a very simple test case that shows a .equals() > method not being invoked on a bean proxied by Weld. > > > In a debugger one can see that GenericBean.equals() is not invoked > within the Servlet: > > protected void doGet(HttpServletRequest request, > HttpServletResponse response) throws ServletException, IOException { > PrintWriter pw = response.getWriter(); > pw.println ("Hello"); > if (gb.equals(new GenericBean(10))) { // GenericBean.equals() is > not invoked; test prints 'fail' > pw.println("pass"); > } else { > pw.println ("fail"); > } > } > > The .war contains source and object code. As you can see there's only > two classes. > > Many thanks, > Emily > =========================== > Emily Jiang > WebSphere Application Server, CDI Development Lead > > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN > Phone: +44 (0)1962 816278 Internal: 246278 > > Email: emijiang at uk.ibm.com > Lotus Notes: Emily Jiang/UK/IBM at IBMGB > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > -- Martin Kouba Software Engineer Red Hat, Czech Republic _______________________________________________ weld-dev mailing list weld-dev at lists.jboss.org https://lists.jboss.org/mailman/listinfo/weld-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20151209/fe68a407/attachment.html From mkouba at redhat.com Thu Dec 10 05:07:35 2015 From: mkouba at redhat.com (Martin Kouba) Date: Thu, 10 Dec 2015 11:07:35 +0100 Subject: [weld-dev] Weld 2.3.2.Final released Message-ID: <56694EE7.4030705@redhat.com> http://weld.cdi-spec.org/news/2015/12/10/weld-232Final/ -- Martin Kouba Software Engineer Red Hat, Czech Republic