[rules-dev] Changing a fact's hashCode causes rules not to fire
Wolfgang Laun
wolfgang.laun at gmail.com
Wed Jun 22 09:37:22 EDT 2011
To avoid misunderstandings: yes, equals() is written according to hashCode,
i.e., according to the usual Java conventions.
If
- an object of class Two contains a member of class One, and
- one object Two and one object One are facts, and
- a rule modifies One, changing its hashCode
then
another rule containing the patterns
$one: One()
$two: Two( $x: one == $one )
does NOT fire (any more).
If you use the constraint
one == $one || != $one
the rule will fire, and you can observe that hashCode results for $one and
$x are the same and that $one.equals( $x ) returns true.
Reproduced using 5.1.1 and 5.2.x
-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110622/3142adc2/attachment.html
More information about the rules-dev
mailing list