Expression like BigDecimal_type_property = BigDecimal_type_property.divide(BigDecimal_value) causes a build failure in executable model.

Solution Unverified - Updated -

Issue

Building a rule which is described in MVEL dialect and uses an expression like BigDecimal_type_property = BigDecimal_type_property.divide(BigDecimal_value) in executable model causes a model generation failure.

For example, when I build a maven project which contains rules executing an expression like (*1) with executable rule models enabled,

package com.example.reproducer

import com.example.reproducer.Bus
import java.math.BigDecimal

dialect "mvel"

rule "bus3d"
    when
        $bus : Bus()
    then
        $bus.weight = $bus.weight.divide(BigDecimal.valueOf(1000));    // ..... (*1)
        System.out.println("***** " + $bus + ", weight = " + $bus.weight);
end

// $bus.weight is a BigDecimal type property.

an error like below occurs.

$ mvn clean compile -DgenerateModel=YES
...
[INFO] --- kie-maven-plugin:7.44.0.Final-redhat-00006:generateModel (default-generateModel) @ reproducer_model_compiler_3d ---
...
[ERROR] Unable to build KieBaseModel:rules
CompilationProblemErrorResult: org.drools.mvelcompiler.MvelCompilerException: RHS doesn't have a type
...

This issue occurs in the case of using the other basic operation add, subtract and multiply as well as divide.

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.

Current Customers and Partners

Log in for full access

Log In