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(a)uk.ibm.com
Lotus Notes: Emily Jiang/UK/IBM@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