[jdom-interest] Namespace.hashcode patch

philip.nelson at omniresources.com philip.nelson at omniresources.com
Wed May 30 14:29:31 PDT 2001

> > When Namespace.equals() was modified to compare only URI's and not
> > prefixes, hashCode() was not similarly adjusted.  Since this 
> > breaks the
> > contract established by java.lang.Object, I would like to 
> propose that
> > hashCode() be modified to simply return uri.hashCode().
> I'm not sure I follow you.  == is object equality.  .equals 
> is semantic
> equality.  We have that with the current implementation.

I see Jason just updated this.  So what we have now is 
Namespace ns1 = Namespace.getNamespace("yyy", "http://ffff");
Namespace ns2 = Namespace.getNamespace("xxx", "http://ffff");

ns1 == ns2

I thought what we settled on was that semantic equality, "are these the same
namespace?" in the xml sense was covered by .equals() only.  "Are these the
same object?" is covered by == and what a java programmer would expect.
There is some precedence for this of course.

More information about the jdom-interest mailing list