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

Compound assignment operation like BigDecimal_type_property += BigDecimal_value causes a compilation error in executable model.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major 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_6c_6d.zip 
      $ cd reproducer_02801729_6c_6d
      $ mvn clean compile exec:exec -DgenerateModel=YES
          :
          :
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_6c_6d ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 6 source files to /work2/cases/02801729/reproducer_02801729_6c_6d/target/classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR : 
      [INFO] -------------------------------------------------------------
      [ERROR] /work2/cases/02801729/reproducer_02801729_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF9/LambdaConsequenceF9B783ABDBE8B65F49FDA13227908E7F.java:[19,56] void cannot be dereferenced
      [INFO] 1 error
      [INFO] -------------------------------------------------------------
          :
          :
      
      Show
      $ unzip reproducer_02801729_6c_6d.zip $ cd reproducer_02801729_6c_6d $ mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_02801729_6c_6d --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to /work2/cases/02801729/reproducer_02801729_6c_6d/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/cases/02801729/reproducer_02801729_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF9/LambdaConsequenceF9B783ABDBE8B65F49FDA13227908E7F.java:[19,56] void cannot be dereferenced [INFO] 1 error [INFO] ------------------------------------------------------------- : :
    • 2020 Week 49-51 (from Nov 30)

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

      • $bus.weight += $bus.weight; ..... (6c) or
      • BigDecimal bd1 = 1000; $bus.weight += bd1; ..... (6d)

      with executable rule models enabled, an error like (*2) occurs. $bus.weight is a BigDecimal type property.

      The same issue also occurs in the case of using '-='.
      For '*=' and '/=', no compilation error occurs but the value of $bus.weight does not change by the operation.

      (*1)

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

      (*2)

      [ERROR] /work2/cases/02801729/reproducer_02801729_6c_6d/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PF9/LambdaConsequenceF9B783ABDBE8B65F49FDA13227908E7F.java:[19,56] void cannot be dereferenced
      

              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

                Created:
                Updated:
                Resolved: