My patch adding hashCode and equals has been applied by Edson.

-W


On 5 August 2010 13:09, Wolfgang Laun <wolfgang.l...@gmail.com> wrote:

> I'm using code such as
>
> KnowledgeRuntime knowledgeRuntime;
> for( KnowledgePackage knowledgePackage:
> knowledgeRuntime.getKnowledgeBase().getKnowledgePackages() ){
>        for( Rule rule: knowledgePackage.getRules() ){
>        }
> }
>
> to obtain rules, intending to construct a Set<Rule>. This, however, breaks
> since repeated executions of
> knowledgePackage.getRules() appear to return different objects and - this
> is the evil thing -
> org.drools.definitions.rule.impl.RuleImpl does not implement hashCode() and
> equals(); hence
> Set<Rules>( rule ).contains( rule ) fails for actually identical rules. I
> consider this a bug in Drools (5.1).
>
> org.drools.definitions.rule.impl.RuleImpl could easily retain a reference
> to
> the org.drools.rule.Rule object from which it is built and delegate
> hashCode/equals to that.
>
> -W
>
>
>
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to