I'm digging through the axis2 codebase, and I've noticed that several
classes (EndpointReference, Options, OperationContext, etc.) define an
isEquivalent method, but don't override equals.  I'm curious, why is this?

There's a comment in org.apache.axis2.client.Options that says
"[isEquivalent] differs from the java.lang.Object.equals() method in that
the equals() method generally looks at both the
object identity (location in
memory) and the object state (data)."

But the only reason equals should look at identity is because identity
equality implies state equality; outside of being an easy shortcut to
satisfy the semantic requirement that an object always equals itself, equals
shouldn't have to rely on identity at all:

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.la
ng.Object) 

Not using equals (and not defining a corresponding hashCode) means that only
identity is used for hash, list, and comparison operations, and not having
an interface that defines the isEquivalent method means there's no general
way to check two objects for equivalence (i.e. You have to add new,
repetitive code any time you want to check two objects for equivalence).

Looking a bit deeper, it seems like these isEquivalent methods don't
actually get used much (or at all, it looks like) within the axis2 codebase.
Operating on the belief that the best code is no code, can these methods be
considered for deprecation and eventual deletion?

On a more general note, and probably more importantly, are there any set
processes on how code gets deprecated, how features are voted in or out,
etc.?  The developer guidelines on the axis2 site don't really get into
this.  

Thanks,
Jason 

Reply via email to