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

The use of the four basic binary operators taking BigDecimal operand(s) causes a compilation error in executable model.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.10.0.GA
    • 7.9.0.GA
    • BRE
    • RHDM 7.9.0.

    • False
    • False
    • Release Notes
    • CR1
    • +
    • Undefined
    • Hide
      $ unzip reproducer_02801729_3b.zip 
      $ cd reproducer_02801729_3b
      $ mvn clean compile exec:exec -DgenerateModel=YES
          :
          :
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_3b ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 6 source files to /test/reproducer_02801729_3b/target/classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR : 
      [INFO] -------------------------------------------------------------
      [ERROR] /test/reproducer_02801729_3b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P3B/LambdaConsequence3B6B2D15753A225FFA39E42DED953773.java:[18,61] bad operand types for binary operator '+'
        first type:  java.math.BigDecimal
        second type: int
      [INFO] 1 error
      [INFO] -------------------------------------------------------------
          :
          :
      
      Show
      $ unzip reproducer_02801729_3b.zip $ cd reproducer_02801729_3b $ mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_3b --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to /test/reproducer_02801729_3b/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /test/reproducer_02801729_3b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P3B/LambdaConsequence3B6B2D15753A225FFA39E42DED953773.java:[18,61] bad operand types for binary operator '+' first type: java.math.BigDecimal second type: int [INFO] 1 error [INFO] ------------------------------------------------------------- : :
    • 2020 Week 49-51 (from Nov 30)

    Description

      Compiling a rule like (*1) which is described in MVEL dialect and uses one of the four basic binary operators ('+', '-', '*', '/') taking BigDecimal type value(s) as operand(s) with executable rule models enabled, a compilation error like (*2) occurs.

      (*1)

      package com.example.reproducer
      
      import com.example.reproducer.Bus
      import java.math.BigDecimal
      
      dialect "mvel"
      
      rule "bus3b"
          when
              $bus : Bus()
          then
              // Actually, errors can occur at all the four basic operators '+', '-', '*', '/' taking BigDecimal as an operand/operands.
              BigDecimal grossWeight = $bus.weight + $bus.capacity * 55 + $bus.maxLoadingWeight;
              System.out.println("***** " + $bus + ", gross weight = " + grossWeight);
      end
      

      $bus.weight and $bus.maxLoadingWeight are BigDecimal type properties.

      (*2)

      [ERROR] /test/reproducer_02801729_3b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P3B/LambdaConsequence3B6B2D15753A225FFA39E42DED953773.java:[18,61] bad operand types for binary operator '+'
        first type:  java.math.BigDecimal
        second type: int
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: