[Red Hat JIRA] (DROOLS-5645) Cannot compile rules that use functions within collects
by Ciprian Chiru (Jira)
[ https://issues.redhat.com/browse/DROOLS-5645?page=com.atlassian.jira.plug... ]
Ciprian Chiru commented on DROOLS-5645:
---------------------------------------
For any additional questions related to this bug report, please address [~erikwiklander]
> Cannot compile rules that use functions within collects
> -------------------------------------------------------
>
> Key: DROOLS-5645
> URL: https://issues.redhat.com/browse/DROOLS-5645
> Project: Drools
> Issue Type: Bug
> Components: executable model
> Affects Versions: 7.43.1.Final
> Reporter: Ciprian Chiru
> Assignee: Luca Molteni
> Priority: Major
>
> Give the following example rule:
>
>
> {code:java}
> import java.util.*;
> global java.util.Set controlSet;
> global org.example.drools.service.DummyService dummyService;
> function String defaultIfBlank(String input, String default){
> return "";
> }
> rule "will execute per each Measurement having ID color"
> no-loop
> when
> Measurement( id == "color", $colorVal : val )
> List(size() > 0) from accumulate(String($s: this) from dummyService.dummy($colorVal), collectList(defaultIfBlank($s, "test")))
> then
> controlSet.add($colorVal);
> end{code}
>
>
> It fails with:
> {code:java}
> [ERROR] Message [id=1, kieBase=defaultKieBase, level=ERROR, path=rules/dummy-rule.drl, line=-1, column=0
> [ERROR] text=Root node of expression should be a declaration]{code}
>
> Can be reproduced with _7.44.0-SNAPSHOT_ .
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months