Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5645

Cannot compile rules that use functions within collects

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.43.1.Final
    • Fix Version/s: None
    • Component/s: executable model
    • Labels:
      None
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Give the following example rule:

       

       

      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

       

       

      It fails with:

      [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]

       

      Can be reproduced with 7.44.0-SNAPSHOT .

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                lucamolteni Luca Molteni
                Reporter:
                cchiru Ciprian Chiru
              • Votes:
                6 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: