[rules-dev] Cast-away bug

Wolfgang Laun wolfgang.laun at gmail.com
Wed Aug 31 07:49:37 EDT 2011


This rule

rule "test"
when
    $l : ArrayList() from collect (MyClass (attribute == false));
then
    for(Object o : new ArrayList( $l )) {
        MyClass o2 = (MyClass) o;
        modify(o2) { setAttribute(true) }
    }
end

does not compile:  The method setAttribute(boolean) is undefined for the
type Object

This, however, works:
   modify( (MyClass)o) { setAttribute(true) }

Explanation?
-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110831/77b5cf61/attachment.html 


More information about the rules-dev mailing list