Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6907

Arithmetic operation with BigDecimal in constraint fails in executable-model

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.69.0.Final
    • 7.68.0.Final
    • executable model
    • None
    • 2022 Week 14-16 (from Apr 4)
    • 2
    • NEW
    • NEW
    • ---
    • ---

    Description

      dialect "mvel"
      
      rule "rule_multiply"
          when
              $fact : Fact( $bd: bd, bd2 == $bd * -1)
          then
              System.out.println("***** $fact = "+$fact);
      end
      

      Fails with

      Execution default-generateModel of goal org.kie:kie-maven-plugin:7.59.0.Final-redhat-00009:generateModel failed: [
      com/example/reproducer/PCD/LambdaExtractorCD1B6E5C7CFD387685758203C8EB22B1.java (25:858) : The operator * is undefined for the argument type(s) BigDecimal, int,
      com/example/reproducer/PF0/LambdaPredicateF08177C575A8F93768627585DF0FD322.java (25:1107) : The operator * is undefined for the argument type(s) BigDecimal, int]
      

      generated code

      public enum LambdaExtractorCD1B6E5C7CFD387685758203C8EB22B1 implements org.drools.model.functions.Function1<java.math.BigDecimal, java.lang.Object>, org.drools.model.functions.HashedExpression {
       ...
          @Override()
          public java.lang.Object apply(java.math.BigDecimal $bd) {
              return $bd * -1;
          }
      }
      

      Note : There are 2 factors:

      • bind variable
      • negative value

      Attachments

        Issue Links

          Activity

            People

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: