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

executable model doesn't resolve bind variable in method call in LHS for property reactivity

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.37.0.Final
    • 7.73.0.Final, 8.36.0.Final
    • executable model
    • None
    • 2023 Week 12-14 (from Mar 20)
    • 2
    • NEW
    • NEW
    • ---
    • ---

    Description

      Issue Description:

      With a rule like this,

      rule R1 
        when
          $fact: Fact($id : a == 99999, convertToString($id) == "BIG")
        then
          modify($fact) { setResult("OK") };
      end
      

      non-exec-model doesn't react to the rule, but exec-model reacts to the rule and causes an infinite loop.

      BAPL-1773 made engine analyze method arguments (in this case, '$id'). If it's a property, it works as property reactivity. However, in case of a bind variable, non-exec-model and exec-model work differently.

      non-exec-model resolves the bind variable to a property name
      https://github.com/kiegroup/drools/blob/7.73.0.Final/drools-mvel/src/main/java/org/drools/mvel/MVELConstraint.java#L460

      exec-model doesn't resolve the bind variable, so considers "no property to react" (= class reactive) and results in the infinite loop.
      https://github.com/kiegroup/drools/blob/7.73.0.Final/drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/builder/generator/expressiontyper/ExpressionTyper.java#L622-L637

      Acceptance Criteria:

      Fix exec-model to resolve the bind variable to meet the non-exec-model behavior.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: