[jboss-jira] [JBoss JIRA] (DROOLS-4375) BigDecimal in from accumulate with MVEL with executable-model

Luca Molteni (Jira) issues at jboss.org
Mon Aug 12 10:02:00 EDT 2019


     [ https://issues.jboss.org/browse/DROOLS-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luca Molteni resolved DROOLS-4375.
----------------------------------
    Resolution: Done


> BigDecimal in from accumulate with MVEL with executable-model
> -------------------------------------------------------------
>
>                 Key: DROOLS-4375
>                 URL: https://issues.jboss.org/browse/DROOLS-4375
>             Project: Drools
>          Issue Type: Bug
>          Components: executable model
>    Affects Versions: 7.24.0.Final
>            Reporter: Toshiya Kobayashi
>            Assignee: Luca Molteni
>            Priority: Major
>              Labels: support
>
> When "from accumulate" uses BigDecimal with Mvel syntax,
> for example)
> {noformat}
> 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
> {noformat}
> It works with non executable-model but fails with executable-model.
> {noformat}
> [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
> {noformat}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list