db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shevek <she...@anarres.org>
Subject hashCode/equals contract broken in BaseObject
Date Tue, 04 May 2004 14:06:34 GMT
hashCode and equals in BaseObject rely only on the primary key. This
breaks horribly (violates the general contract of hashCode()/equals()) if 
you compare two objects of different classes.

It MUST compare ob.getClass() as well as ob.getPrimaryKey() and include
ob.getClass().hashCode() in its hashCode() [by xor?] [or something
equivalent].

No doubt the reason for this violation is noted in the FAQ, but it seems
worth noting as a serious bug since it means I can't use Torque objects as 
hash keys.

S.

-- 
Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message