Compilation error occurs for rules written in mvel dialect in executable model.

Solution Unverified - Updated -

Issue

Compiling rules written in mvel dialect which use binary operation taking java.math.BigDecimal type operands causes an error.
When I build a maven project which contains the following rule in executable model,

package org.example.reproducer

import org.example.reproducer.Person;

dialect "mvel"

rule "salary-increase"
    when
        $p : Person( age >= 26 )
    then
        System.out.println("***** Action of rule \"salary-increase\"");
        $p.salary = $p.salary + 50000;
end

compilation error occurs with the messages like below.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /path/to/project1/target/generated-sources/drools-model-compiler/main/java/org/example/reproducer/Rules2a5935db629e45d8b951392188ce055cRuleMethods0.java:[36,76] salary has private access in org.example.reproducer.Person
[ERROR] /path/to/project1/target/generated-sources/drools-model-compiler/main/java/org/example/reproducer/Rules2a5935db629e45d8b951392188ce055cRuleMethods0.java:[36,101] bad operand types for binary operator '+'
  first type:  java.math.BigDecimal
  second type: int
[INFO] 2 errors

Where $p.salary is a java.math.BigDecimal type property of Person.

Environment

  • Red Hat Decision Manager (RHDM)
    • 7.5.0 - 7.8.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