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

Model compiler cannot generate declaration from a function call

    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
    • executable model
    • None
    • 2020 Week 31-33 (from Jul 27)
    • Hide

      Using the example rule above, building it, org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile will throw the error described above.

      Show
      Using the example rule above, building it,  org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile will throw the error described above.
    • NEW
    • NEW

    Description

      Given the example rule below (based on the drools example rule)

       

      global java.util.Set controlSet;
      
      declare A
       x: String
      end
      
      declare B
       a: A
      end
      
      function String dummyFunction(B b) {
       return "test";
      }
      
      rule "will execute per each Measurement having ID color"
      no-loop
      when
       Measurement( id == "color", $colorVal : val )
       $b: B()
       $val: String() from dummyFunction($b.a)
      then
       controlSet.add($colorVal);
      end

       

       

      When compiling the rule with kie-maven-plugin it fails with :

      ...target/generated-sources/drools-model-compiler/main/java/rules/Rules5937a2896da74f01bfa36d294bcf0858RuleMethods0.java:[32,107] cannot find symbol
      [ERROR] symbol: variable $b
      [ERROR] location: class rules.Rules5937a2896da74f01bfa36d294bcf0858RuleMethods0

      It transpiles and compiles fine with: 

      $val: String() from dummyFunction($b)

       

      This can probably be reproduced on all version. 

      It works when the rules are not pre-compiled.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: