My patch adding hashCode and equals has been applied by Edson.<br><br>-W<br><br><br><div class="gmail_quote">
On 5 August 2010 13:09, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I&#39;m using code such as <br><br>KnowledgeRuntime knowledgeRuntime;<br>for( KnowledgePackage knowledgePackage: knowledgeRuntime.getKnowledgeBase().getKnowledgePackages() ){     <br>       for( Rule rule: knowledgePackage.getRules() ){<br>


       }<br>}<br><br>to obtain rules, intending to construct a Set&lt;Rule&gt;. This, however, breaks since repeated executions of <br>knowledgePackage.getRules() appear to return different objects and - this is the evil thing -<br>


org.drools.definitions.rule.impl.RuleImpl does not implement hashCode() and equals(); hence<br>Set&lt;Rules&gt;( rule ).contains( rule ) fails for actually identical rules. I consider this a bug in Drools (5.1).<br><br>org.drools.definitions.rule.impl.RuleImpl could easily retain a reference to<br>


the org.drools.rule.Rule object from which it is built and delegate hashCode/equals to that.<br><font color="#888888"><br>-W<br><br><h2><font size="-1"><br></font></h2>
</font></blockquote></div><br>