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

BigDecimal_variable % Numeric_value operation causes a compilation error in executable model.

    XMLWordPrintable

Details

    • Bug
    • Status: Verified (View Workflow)
    • Major
    • Resolution: Done
    • 7.1.0.GA, 7.9.0.GA
    • 7.10.1.GA
    • BRE
    • This issue occurs on RHDM 7.1.0 to RHDM 7.9.0.

    • CR1
    • Hide
      • Extract reproducer.
        $ unzip reproducer_mc_1b.zip
        $ cd reproducer_mc_1b
        
      • Build and execute the rule.
        $ ./run_mvn    # mvn clean compile exec:exec -DgenerateModel=YES
            :
            :
        [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1b ---
        [INFO] Changes detected - recompiling the module!
        [INFO] Compiling 9 source files to /work2/testdir/reproducer_mc_1b/target/classes
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,133] bad operand types for binary operator '%'
          first type:  java.math.BigDecimal
          second type: int
        [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,324] bad operand types for binary operator '%'
          first type:  java.math.BigDecimal
          second type: int
        [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,516] bad operand types for binary operator '%'
          first type:  java.math.BigDecimal
          second type: int
        [INFO] 3 errors 
        [INFO] -------------------------------------------------------------
            :
            :
        
      Show
      Extract reproducer. $ unzip reproducer_mc_1b.zip $ cd reproducer_mc_1b Build and execute the rule. $ ./run_mvn # mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1b --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 9 source files to /work2/testdir/reproducer_mc_1b/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,133] bad operand types for binary operator '%' first type: java.math.BigDecimal second type: int [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,324] bad operand types for binary operator '%' first type: java.math.BigDecimal second type: int [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,516] bad operand types for binary operator '%' first type: java.math.BigDecimal second type: int [INFO] 3 errors [INFO] ------------------------------------------------------------- : :
    • Release Notes
    • 2020 Week 52-03 (from Dec 21), 2021 Week 07-09 (from Feb 15)
    • +

    Description

      Building a rule written in MVEL dialect like (*1) using BigDecimal_variable % Numeric_value operation (*1-1) in executable rule model, a compilation error (*2) occurs.

      (*1)

      package com.example.reproducer
      
      import com.example.reproducer.Fact
      
      dialect "mvel"
      
      rule "rule1b"
          when
              $fact : Fact( $year : year, (($year % 400) == 0) || ((($year % 4) == 0) && (($year % 100) != 0)), $flag : "YES" )    // ..... (*1-1)
          then
              modify($fact) {
                  leapYear = $flag
              }
              System.out.println("***** $fact: " + $fact + ", " + $year + " is a leap year? " + $fact.leapYear);
      end
      

      (*2)

      [ERROR] /work2/testdir/reproducer_mc_1b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF6/LambdaPredicateF6282A65CE56BF77478DD6D1D7E1AFE4.java:[17,133] bad operand types for binary operator '%'
        first type:  java.math.BigDecimal
        second type: int
      

      Attachments

        Issue Links

          Activity

            People

              lmolteni@redhat.com Luca Molteni
              rhn-support-myoshida Masato Yoshida
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: