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

Drools model compilation fails when using object builders within method calls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 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
    • None
    • None
    • 2020 Week 31-33 (from Jul 27)
    • Hide

      Using the example rule above, the compiler throws the error listed above.

      Show
      Using the example rule above, the compiler throws the error listed above.
    • NEW
    • NEW

    Description

      Given the example rule below:

      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

       

      compiling the rule with kie-maven-plugin, it throws the error:

      ...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

       

      Same rule when not pre-compiled runs fine.

       

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: