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

Compound assignment operation like BigDecimal_type_property += Numeric_value causes compilation errors in executable model.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.10.0.GA
    • 7.9.0.GA
    • BRE
    • The issue was found in RHDM 7.9.0.

    • False
    • False
    • Release Notes
    • CR1
    • +
    • Undefined
    • Hide
      $ unzip reproducer_02801729_6a_6b.zip 
      $ cd reproducer_02801729_6a_6b
      $ mvn clean compile exec:exec -DgenerateModel=YES
          :
          :
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_6a_6b ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 6 source files to /work2/cases/02801729/reproducer_02801729_6a_6b/target/classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR : 
      [INFO] -------------------------------------------------------------
      [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,13] weight has private access in com.example.reproducer.Bus
      [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,21] bad operand types for binary operator '+'
        first type:  java.math.BigDecimal
        second type: int
      [INFO] 2 errors 
      [INFO] -------------------------------------------------------------
          :
          :
      
      Show
      $ unzip reproducer_02801729_6a_6b.zip $ cd reproducer_02801729_6a_6b $ mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_6a_6b --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to /work2/cases/02801729/reproducer_02801729_6a_6b/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,13] weight has private access in com.example.reproducer.Bus [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,21] bad operand types for binary operator '+' first type: java.math.BigDecimal second type: int [INFO] 2 errors [INFO] ------------------------------------------------------------- : :
    • 2020 Week 49-51 (from Nov 30)

    Description

      Compiling a rule like (*1) which is described in MVEL dialect and uses a compound assignment operation like BigDecimal_type_property += Numeric_value, for example,

      • $bus.weight += 1000; ..... (6a) or
      • num = 100; $bus.weight += num; ..... (6b)

      with executable rule models enabled, errors like (*2) occur. $bus.weight is a BigDecimal type property.
      This issue occurs in the case of using the other basic operations '-=', '*=', '/=' as well as '+='.

      (*1)

      package com.example.reproducer
      
      import com.example.reproducer.Bus
      
      dialect "mvel"
      
      rule "bus6a"
          when
              $bus : Bus()
          then
              $bus.weight += 1000;    ..... (6a)
              System.out.println("***** " + $bus + ", weight = " + $bus.weight);
              update($bus);
      end
      

      (*2)

      [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,13] weight has private access in com.example.reproducer.Bus
      [ERROR] /work2/cases/02801729/reproducer_02801729_6a_6b/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P86/LambdaConsequence86B94E0EB0387F8D724213EF209CA726.java:[19,21] 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
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: