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

Type coercion between BigDecimal and other arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 7.52.0.Final
    • executable model
    • 2021 Week 22-24 (from May 31)
    • 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
    • Undefined
    • NEW
    • NEW

    Description

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

      dialect "mvel"
      
      rule "rule_calc_with_external_function_lhs"
          when
              $fact : Fact( $bd : (extFunc(bd1) * 100 + 12))
          then
              System.out.println("*****[LHS] Fact.bd1 ("+ $fact.bd1+ ") * 100 + 12 is " + $bd);
      end
      
      rule "rule_calc_with_function_lhs"
          when
              $fact : Fact( $bd : (func(bd1) * 100 + 12))
          then
              System.out.println("*****[LHS] Fact.bd1 ("+ $fact.bd1+ " )* 100 + 12 is " + $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
      
      

      Attachments

        Issue Links

          Activity

            People

              lmolteni@redhat.com Luca Molteni
              lmolteni@redhat.com Luca Molteni
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: