[
https://issues.redhat.com/browse/DROOLS-5682?page=com.atlassian.jira.plug...
]
Matteo Casalino updated DROOLS-5682:
------------------------------------
Description:
As of Drools {{7.32.0.Final}}, {{forall}} patterns with "empty list" constraints
combined with other constraints through {{||}} will fail to match as expected.
For example the following rule:
{noformat}
rule "forall with not equal"
when forall($p : Pojo(y == 1)
Pojo(x.empty || x contains 2, z == 3, this == $p))
then
end
{noformat}
will not fire against following facts:
{noformat}
Pojo{x=[2], y=0, z=0}
Pojo{x=[], y=1, z=3}
Pojo{x=[3], y=0, z=3}
Pojo{x=[2], y=1, z=3}
{noformat}
We suspect a problem with the rewriting of the {{forall}} clause. It appears the clause is
rewritten as:
{{not Pojo(y == 1, (x.empty && !(x contains 2)) || !(z == 3))}}
instead of the expected:
{{not Pojo(y == 1, (!(x.empty) && !(x contains 2)) || !(z == 3))}}
This is working fine when using Drools {{<= 7.31.0.Final}}.
was:
As of Drools 7.32.0.Final, {{forall}} patterns with "empty list" constraints
combined with other constraints through {{or}} will fail to match as expected.
For example the following rule:
{noformat}
rule "forall with not equal"
when forall($p : Pojo(y == 1)
Pojo(x.empty || x contains 2, z == 3, this == $p))
then
end
{noformat}
will not fire against following facts:
{noformat}
Pojo{x=[2], y=0, z=0}
Pojo{x=[], y=1, z=3}
Pojo{x=[3], y=0, z=3}
Pojo{x=[2], y=1, z=3}
{noformat}
We suspect a problem with the rewriting of the {{forall}} clause. It appears the clause is
rewritten as:
{{not Pojo(y == 1, (x.empty && !(x contains 2)) || !(z == 3))}}
instead of the expected:
{{not Pojo(y == 1, (!(x.empty) && !(x contains 2)) || !(z == 3))}}
This is working fine when using Drools {{<= 7.31.0.Final}}.
Forall with empty list constraint combined with or does not fire as
expected
----------------------------------------------------------------------------
Key: DROOLS-5682
URL:
https://issues.redhat.com/browse/DROOLS-5682
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.32.0.Final, 7.33.0.Final, 7.34.0.Final, 7.35.0.Final,
7.36.0.Final, 7.37.0.Final, 7.38.0.Final, 7.39.0.Final, 7.40.0.Final, 7.41.0.Final,
7.42.0.Final, 7.43.0.Final
Reporter: Matteo Casalino
Assignee: Mario Fusco
Priority: Major
Attachments: forall-with-empty-list-constraint-combined-with-or.zip
As of Drools {{7.32.0.Final}}, {{forall}} patterns with "empty list"
constraints combined with other constraints through {{||}} will fail to match as
expected.
For example the following rule:
{noformat}
rule "forall with not equal"
when forall($p : Pojo(y == 1)
Pojo(x.empty || x contains 2, z == 3, this == $p))
then
end
{noformat}
will not fire against following facts:
{noformat}
Pojo{x=[2], y=0, z=0}
Pojo{x=[], y=1, z=3}
Pojo{x=[3], y=0, z=3}
Pojo{x=[2], y=1, z=3}
{noformat}
We suspect a problem with the rewriting of the {{forall}} clause. It appears the clause
is rewritten as:
{{not Pojo(y == 1, (x.empty && !(x contains 2)) || !(z == 3))}}
instead of the expected:
{{not Pojo(y == 1, (!(x.empty) && !(x contains 2)) || !(z == 3))}}
This is working fine when using Drools {{<= 7.31.0.Final}}.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)