Re: hashCode method in Datatype
Kohsuke Kawaguchi <[email protected]> Wed, 03 Nov 2004 09:59:49 -0800
| Newsgroups | gmane.text.xml.relaxng.general |
|---|---|
| Message-ID | <[email protected]> |
Elliotte Harold wrote: > The JavaDoc for the valueHashCode(Object) method in > org.relaxng.datatype.Datatype states: > > public int valueHashCode(java.lang.Object value) > > Computes the hash code for a value object, which is consistent with the > sameValue method. > > What should this method do if the value object passed as an argument is > not an instance of the datatype returned by createValue()? Throw an > exception? Return that object's hashCode? Something else? The spec does > not clarify. > > For sameValue() the spec states. "The behavior is undefined if objects > not created by this type are passed. It is the caller's responsibility > to ensure that value objects belong to this type." However there's no > such wording for valueHashCode. I suggest we put the same sentence to valueHashCode() -- Kohsuke Kawaguchi Sun Microsystems [email protected]