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

Cannot compile rules that use functions within collects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 7.43.1.Final
    • executable model
    • None
    • Undefined
    • NEW
    • 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 .

      Attachments

        Activity

          People

            lmolteni@redhat.com Luca Molteni
            cchiru Ciprian Chiru (Inactive)
            Votes:
            6 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: