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

executable model wrongly rewrites modify in if-block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.42.0.Final
    • 7.67.0.Final, 7.74.0.Final, 8.40.0.Final
    • executable model
    • None
    • 2023 Week 27-29 (from Jul 3)
    • 2
    • NEW
    • NEW
    • ---
    • ---

      Issue Description:

      When exec-model rewrites the following RHS,

        then
          if (false) {
            modify($fact) {
              value1 = 2
            }
          }
      

      it moves "drools.update" to the end of execute method. It causes an unexpected update.

          public void execute(org.drools.model.Drools drools, org.drools.modelcompiler.PropertyReactivityMatrixTest.Fact $fact) throws java.lang.Exception {
              if (false) {
                  {
                      $fact.setValue1(2);
                  }
              }
              drools.update($fact, mask_$fact);
          }
      }
      

      Another test case is

        then
          if (false) {
            $fact.setValue1(2);
          }
          if (true) {
            modify($fact) {
            }
          }
      

      becomes

          @Override()
          public void execute(org.drools.modelcompiler.PropertyReactivityMatrixTest.Fact $fact) throws java.lang.Exception {
              {
                  if (false) {
                      $fact.setValue1(2);
                  }
                  if (true) {
                      {
                      }
                  }
              }
          }
      

      Acceptance Criteria:

      drools.update is executed in the same if-block.

      Additional Information:

      Found while working on DROOLS-7492

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

              Created:
              Updated:
              Resolved: