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

BigDecimal in from accumulate with MVEL with executable-model

    Details

      Description

      When "from accumulate" uses BigDecimal with Mvel syntax,

      for example)

      import org.drools.modelcompiler.domain.Person;
      import java.math.BigDecimal;
      global java.util.List list;
      dialect "mvel"
      rule R when
        $b : BigDecimal() from accumulate (
                  Person( $money : money ),
                      init( BigDecimal sum = 0; ),
                      action( sum += $money; ),
                      reverse( sum -= $money; ),
                      result( sum )
               )
      then
        list.add($b);
      end
      

      It works with non executable-model but fails with executable-model.

      [ERROR] Failures: 
      [ERROR]   AccumulateTest.testFromAccumulateBigDecimalMvel:1273->BaseModelTest.getKieSession:99->BaseModelTest.getKieSession:103->BaseModelTest.getKieContainer:107->BaseModelTest.getKieContainer:114->BaseModelTest.createKieBuilder:125->BaseModelTest.createKieBuilder:152 [Message [id=1, level=ERROR, path=src/main/java/defaultpkg/RAccumulate6.java, line=28, column=20
         text=incompatible types: int cannot be converted to java.math.BigDecimal], Message [id=2, level=ERROR, path=src/main/java/defaultpkg/RAccumulate6.java, line=32, column=18
         text=bad operand types for binary operator '+'
        first type:  java.math.BigDecimal
        second type: java.math.BigDecimal], Message [id=3, level=ERROR, path=src/main/java/defaultpkg/RAccumulate6.java, line=36, column=18
         text=bad operand types for binary operator '-'
        first type:  java.math.BigDecimal
        second type: java.math.BigDecimal], Message [id=4, level=ERROR, path=src/main/java/defaultpkg/RAccumulate6.java, line=0, column=0
         text=Java source of src/main/java/defaultpkg/RAccumulate6.java in error:
      package defaultpkg
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lucamolteni Luca Molteni
                  Reporter:
                  tkobayashi Toshiya Kobayashi
                  Tester:
                  Tibor Zimanyi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: