[jboss-jira] [JBoss JIRA] (DROOLS-5237) Wrong property reactivity with non getter chain outside of modify block

Toshiya Kobayashi (Jira) issues at jboss.org
Wed Apr 15 04:54:00 EDT 2020


Toshiya Kobayashi created DROOLS-5237:
-----------------------------------------

             Summary: Wrong property reactivity with non getter chain outside of modify block
                 Key: DROOLS-5237
                 URL: https://issues.redhat.com/browse/DROOLS-5237
             Project: Drools
          Issue Type: Bug
          Components: executable model
    Affects Versions: 7.36.0.Final
            Reporter: Toshiya Kobayashi
            Assignee: Luca Molteni


The rule below causes infinite loop with executable model because "name" is considered as modified property. 
{noformat}
rule R1 when
    $p : Person( name == "Mario" )
then
    System.out.println("name.length = " + $p.getName().length());
    modify($p) { setAge(41) };
end
{noformat}

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

https://github.com/kiegroup/drools/blob/master/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java#L698-L700

Executable model follows the approach in this commit:

https://github.com/kiegroup/drools/commit/fc924465437919d5b6bd99849ee595e6e7ebf957

but executable model evaluates method calls outside of modify block while standard-drl evaluates only inside modify block.




--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list