Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3193

Modify block does not work with variables declared in the consequence

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.3.0.CR1
    • 5.2.0.Final, 5.3.0.Beta1
    • drools-compiler
    • None

      Reported by Wolfgang:

      ========

      This rule

      test.drl
      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) } 
      

            etirelli@redhat.com Edson Tirelli
            etirelli@redhat.com Edson Tirelli
            Archiver:
            rhn-support-ceverson Clark Everson

              Created:
              Updated:
              Resolved:
              Archived: