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

Arithmetic operations with BigDecimal for a variable in constraint cause a compilation error in executable model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.11.1.GA
    • 7.10.1.GA
    • BRE
    • False
    • False
    • CR1
    • +
    • Undefined
    • Hide

      Download attached reproducer and run it by

      mvn clean compile exec:exec -DgenerateModel=YES
      

      On the other hand, the following commands succeed.

      mvn clean compile exec:exec -DgenerateModel=NO
      
      Show
      Download attached reproducer and run it by mvn clean compile exec:exec -DgenerateModel=YES On the other hand, the following commands succeed. mvn clean compile exec:exec -DgenerateModel=NO
    • 2021 Week 16-18 (from Apr 19), 2021 Week 19-21 (from May 10), 2021 Week 22-24 (from May 31)

      When arithmetic operations is used with a field(s) of BigDecimal in LHS like the following, 

      rule "rule_addition_bd"
          when
              $fact : Fact( $bd: (bd1 + bd2) )
          then
              System.out.println("***** $fact: " + $fact + ", bd1 + bd2 = "+$bd);
      end
      
      rule "rule_addition_int" 
          when 
              $fact : Fact( $bd: (bd1 + 100) ) 
          then 
              System.out.println("***** $fact: " + $fact + ", bd1 + 100 = "+$bd);
       end
       

      build of executable model fails with the error like:

      [ERROR] /path/to/reproducer_bd_arthmetic/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P37/LambdaExtractor376B932463BA628A4DCB2BE232AC4A7B.java:[22,31] bad operand types for binary operator '+'
      [ERROR]   first type:  java.math.BigDecimal
      [ERROR]   second type: java.math.BigDecimal
      
      [ERROR] /path/to/reproducer_bd_arthmetic/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P15/LambdaExtractor15F9A9FEFE61705DE8D800222D699200.java:[22,31] bad operand types for binary operator '+'
      [ERROR]   first type:  java.math.BigDecimal
      [ERROR]   second type: int
      
      

              lmolteni@redhat.com Luca Molteni
              rhn-support-hmiura Hiroko Miura
              Paolo Bizzarri Paolo Bizzarri
              Paolo Bizzarri Paolo Bizzarri
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: