Oops, the collection stuff was leftovers from earlier when I had
which also fails.
The default equals method (of Object) checks if the objects are identical and returns false otherwise. So this behaviour is to be expected.
Overwrite equals() to get the behaviour you want.
It seems you shouldn't have to override equals() to get reflexive equality.
Like I said, maybe it's not a bug, but it sure as heck has the potential to cause confusion.
Matt, can you file an issue - I'm not sure if its something thats improvable on, but if there is an issue then hopefully Gavin can take a look when he's less busy :)
Just a thought: wouldn't it be enough to let equals check the defined component name and scope for equality? That assumes that the name/scope pair is unique to the object and immutable, which holds as far as I can see?