Compound assignment operation BigDecimal_type_property += BigDecimal_value causes a compilation error in executable model.
Issue
Building a rule which is written in MVEL dialect and contains a compound assignment operation BigDecimal_type_property += BigDecimal_value in executable model, a compilation error occurs. Where BigDecimal_value is a BigDecimal-type property or a BigDecimal-type variable.
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 "bus6c"
when
$bus : Bus()
then
$bus.weight += $bus.weight; ..... (*1)
System.out.println("***** " + $bus + ", weight = " + $bus.weight);
update($bus);
end
an error like below occurs.
$ mvn clean compile exec:exec -DgenerateModel=YES
...
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_model_compiler_6c_6d ---
...
[ERROR] /work2/testdir/reproducer_model_compiler_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF9/LambdaConsequenceF9B783ABDBE8B65F49FDA13227908E7F.java:[19,56] void cannot be dereferenced
...
Error messages are varied depending on RHDM release. The error message above is seen on RHDM 7.9.0 or 7.9.1.
On 7.8.0 or 7.8.1 release, the following error message is seen,
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.39.0.Final-redhat-00005:generateModel (default-generateModel) on project reproducer_model_compiler_6c_6d: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.39.0.Final-redhat-00005:generateModel failed: (line 2,col 5) Illegal left hand side of an assignment.
on the release from 7.5.0 to 7.7.1, the following error messages are seen.
[ERROR] /work2/testdir/reproducer_model_compiler_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules6aee29563bfa4190b7080abbb2bbabfeRuleMethods0.java:[27,78] unexpected type
required: variable
found: value
[ERROR] /work2/testdir/reproducer_model_compiler_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules6aee29563bfa4190b7080abbb2bbabfeRuleMethods0.java:[28,103] void cannot be dereferenced
This issue occurs in the case of using -=
as well as +=
. For *=
and /=
, no compilation error occurs but the assignee BigDecimal-type property (e.g. $bus.weight
in the example above) does not change by the operation.
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.