]
Luca Molteni updated DROOLS-5894:
---------------------------------
Sprint: 2020 Week 49-51 (from Nov 30)
Compound assignment operation like BigDecimal_type_property +=
Numeric_value causes compilation errors in executable model.
---------------------------------------------------------------------------------------------------------------------------
Key: DROOLS-5894
URL:
https://issues.redhat.com/browse/DROOLS-5894
Project: Drools
Issue Type: Bug
Components: executable model
Reporter: Luca Molteni
Assignee: Luca Molteni
Priority: Major
Labels: support
Compiling a rule like (*1) which is described in MVEL dialect and uses a compound
assignment operation like _BigDecimal_type_property_ += _Numeric_value_, for example,
- $bus.weight += 1000; ..... (6a) or
- num = 100; $bus.weight += num; ..... (6b)
with executable rule models enabled, errors like (*2) occur. $bus.weight is a BigDecimal
type property.
This issue occurs in the case of using the other basic operations '-=',
'*=', '/=' as well as '+='.
(*1)
{noformat}
package com.example.reproducer
import com.example.reproducer.Bus
dialect "mvel"
rule "bus6a"
when
$bus : Bus()
then
$bus.weight += 1000; ..... (6a)
System.out.println("***** " + $bus + ", weight = " +
$bus.weight);
update($bus);
end
{noformat}
(*2)
{noformat}
[ERROR]
/work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,13]
weight has private access in com.example.reproducer.Bus
[ERROR]
/work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,21]
bad operand types for binary operator '+'
first type: java.math.BigDecimal
second type: int
{noformat}