[
https://issues.redhat.com/browse/DROOLS-5549?page=com.atlassian.jira.plug...
]
Ciprian Chiru updated DROOLS-5549:
----------------------------------
Description:
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.
was:
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))
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 returns the error:
{code:java}
[org.example.drools.service.RulesSession] (main) Message [id=1, kieBase=defaultKieBase,
level=ERROR,
path=/home/vagrant/git/drools-rules-engine-prototypes/drools-kjar-project/rules/target/classes/rules/dummy-rule.drl,
line=-1, column=0
text=Unable to Analyse Expression dummyFunction(Map.of($colorVal)):
[Error: unable to resolve method using strict-mode: java.util.Map.of(java.lang.String)]
[Near : {... dummyFunction(Map.of($colorVal)) ....}] {code}
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: Mario Fusco
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.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)