Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1904

Arithmetic operation with BigDecimal in constraint fails in executable-model

    XMLWordPrintable

Details

    • 2
    • False
    • None
    • False
    • CR1
    • +
    • 2022 Week 17-19 (from Apr 25), 2022 Week 20-22 (from May 16), 2022 Week 26-28 (from Jun 27), 2022 Week 29-31 (from Jul 18)

    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-hmiura Hiroko Miura
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: