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

Details

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

    Description

      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) } 
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty