-
Bug
-
Resolution: Done
-
Major
-
None
-
7.17.0.Final
-
2019 Week 05-07
-
- See unit test PR
-
NEW
-
NEW
Under the condition:
- LHS has a constraint which calls a function
- The function's argument contains "=="
- The constraint itself uses "==" for comparison
So the rules look like this:
package com.sample import org.drools.compiler.Person; function int myFunction(String expression, int value) { if (expression.equals("param == 10") && value == 10) { return 1; } return 0; } rule R1 when $p: Person(myFunction("param == 10", age) == 1) then end rule R2 when $p: Person(myFunction("param == 20", age) == 1) then end
In this case, AlphaNodes are shared so both rules match against a fact which should match only R1 (Person(age = 10)).
Dump by ReteDumper
[EntryPointNode(1) EntryPoint::DEFAULT ] on Partition(MAIN) [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ] on Partition(MAIN) [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.compiler.Person] expiration=-1ms ] on Partition(MAIN) [AlphaNode(4) constraint=myFunction("param == 10", age) == 1] on Partition(1) d 0 i 0 [LeftInputAdapterNode(5)] on Partition(1) Ld 0 Li 0 [RuleTerminalNode(6): rule=R1] on Partition(1) d 0 i 0 [RuleTerminalNode(7): rule=R2] on Partition(1) d 0 i 0
It seems to relate to MvelConstraint.equals() logic. (It doesn't take account of the text between "==" and "==")