That sounds like a good idea to me.

On Sun, May 8, 2011 at 19:00, Holly Cummins <[email protected]> wrote:
> Hi all,
>
> I've hit another piece of behaviour which surprised me. If I perform
> operations on an injected service, I see the following behaviour for ==
> and equals()
>
> thing == thing -> true (reassuringly)
> thing.equals(thing) -> false (unexpectedly!)
>
> What's going on is that when equals is called, the proxy delegates to the
> 'real' object, which doesn't have an implementation of equals(). The real
> object does an == check, compares itself for identity with the proxied
> object. These two objects aren't == identical, so equals() returns false.
>
> One workaround is to implement equals() on my service objects, but it
> doesn't feel right that users have to implement equals() just for
> thing.equals(thing) to return true.
>
> The other option is that our proxy implementation could special case
> equals, and do an == check before delegating to the 'real' object if the
> answer is false. Not only would this give more consistent equals()
> behaviour, it might also give a slight performance win.
>
> Opinions?
>
> Holly
> --
> Holly Cummins
> OSGi Applications
> Desk DE3B18, MP 211,
> IBM Hursley, UK
> [email protected]
> Phone: External +44 (0) 1962 815104 ; Internal 7-245104;
>
>
>
>
>
> 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
>
>
>
>
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/

Reply via email to