]
Mario Fusco reassigned DROOLS-5549:
-----------------------------------
Assignee: Luca Molteni (was: Mario Fusco)
Drools model compilation fails when using object builders within
method calls
-----------------------------------------------------------------------------
Key: DROOLS-5549
URL:
https://issues.redhat.com/browse/DROOLS-5549
Project: Drools
Issue Type: Bug
Affects Versions: 7.31.0.Final, 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
Reporter: Ciprian Chiru
Assignee: Luca Molteni
Priority: Major
Given the example rule below:
{code:java}
import org.example.drools.model.*;
import java.util.Map;
global java.util.Set controlSet;
function String dummyFunction(Map m) {
return "test";
}
rule "will execute per each Measurement having ID color"
no-loop
when
Measurement( id == "color", $colorVal : val )
$val: String() from dummyFunction(Map.of($colorVal, "something"))))
then
controlSet.add($colorVal);
end{code}
compiling the rule with kie-maven-plugin, it throws the error:
{code:java}
...target/generated-sources/drools-model-compiler/main/java/rules/Rules57a04348fad44377b9eacd9bb5741999RuleMethods0.java:[30,117]
cannot find symbol
[ERROR] symbol: variable $colorVal
[ERROR] location: class rules.Rules57a04348fad44377b9eacd9bb5741999RuleMethods0{code}
Same rule when not pre-compiled runs fine.