Compound assignment operation BigDecimal_type_property += Numeric_value causes compilation errors in executable model.
Issue
Building a rule which is written in MVEL dialect and contains a compound assignment operation BigDecimal_type_property += Numeric_value in executable model, compilation errors occur. Where Numeric_value is a numeric variable or a numeric literal.
For example, when I build a rule which uses a statement like (*1) with executable rule models enabled,
package com.example.reproducer
import com.example.reproducer.Bus
dialect "mvel"
rule "bus6a"
when
$bus : Bus()
then
$bus.weight += 1000; ..... (*1)
System.out.println("***** " + $bus + ", weight = " + $bus.weight);
update($bus);
end
// $bus.weight is a BigDecimal-type property.
compilation errors like below occur.
$ mvn clean compile exec:exec -DgenerateModel=YES
...
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_model_compiler_6a_6b ---
...
[ERROR] /work2/testdir/reproducer_model_compiler_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/testdir/reproducer_model_compiler_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
...
This issue occurs in the case of using the other basic operations -=
, *=
, /=
as well as +=
.
Environment
- Red Hat Decision Manager (RHDM)
- 7.5.0 - 7.9.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.