Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5237

Wrong property reactivity with non getter chain of non-direct statements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.37.0.Final
    • 7.36.0.Final
    • executable model
    • None
    • 2020 Week 16-18 (from Apr 13)
    • 3
    • NEW
    • NEW

      DROOLS-5025 solved a case like this by excluding getter property from property reactivity mask.

      rule R1 when
          $p : Person( name == "Mario" )
      then
          System.out.println("name = " + $p.getName());
          modify($p) { setAge(41) };
      end
      

      However, there are still some cases which cause unexpected property reactivity.

      For example, the rule below causes an infinite loop with executable model because "name" is considered as modified property.

      rule R1 when
          $p : Person( name == "Mario" )
      then
          System.out.println("name.length = " + $p.getName().length());
          modify($p) { setAge(41) };
      end
      

      update() without modify block has the same issue.

      In standard-drl (DialectUtil.parseModifiedProperties), "getter + otherMethod" chain is considered that the property is modified. So excutable model follows the same.

      However, executable model evaluates all method calls in RHS while standard-drl evaluates only direct statements like "setName("AAA");" or "getName().xxx();". executable model also should follow.

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: