[relaxng-user] hashCode method in Datatype

Kohsuke Kawaguchi Kohsuke.Kawaguchi at Sun.COM
Wed Nov 3 09:59:49 ICT 2004


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                   kohsuke.kawaguchi at sun.com


More information about the relaxng-user mailing list