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

The use of AND in source pattern of accumulate causes 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 all releases from RHDM 7.1.0 to 7.9.0.

    • CR1
    • Hide
      1. Extract reproducer.
        $ unzip reproducer_model_compiler_7a.zip
        $ cd reproducer_model_compiler_7a
        
      2. 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_model_compiler_7a ---
        [INFO] Changes detected - recompiling the module!
        [INFO] Compiling 13 source files to /work2/testdir/reproducer_model_compiler_7a/target/classes
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /work2/testdir/reproducer_model_compiler_7a/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rulese69ee9f6a2a84acaa675792cae099156RuleMethods0.java:[28,63] method accumulate in class org.drools.model.DSL cannot be applied to given types;
          required: org.drools.model.view.ViewItem<?>,org.drools.model.functions.accumulate.AccumulateFunction,org.drools.model.functions.accumulate.AccumulateFunction[]
          found: org.drools.model.view.ViewItem
          reason: cannot infer type-variable(s) T
            (actual and formal argument lists differ in length)
        [INFO] 1 error
        [INFO] -------------------------------------------------------------
            :
            :
        
      Show
      Extract reproducer. $ unzip reproducer_model_compiler_7a.zip $ cd reproducer_model_compiler_7a 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_model_compiler_7a --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 13 source files to /work2/testdir/reproducer_model_compiler_7a/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/testdir/reproducer_model_compiler_7a/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rulese69ee9f6a2a84acaa675792cae099156RuleMethods0.java:[28,63] method accumulate in class org.drools.model.DSL cannot be applied to given types; required: org.drools.model.view.ViewItem<?>,org.drools.model.functions.accumulate.AccumulateFunction,org.drools.model.functions.accumulate.AccumulateFunction[] found: org.drools.model.view.ViewItem reason: cannot infer type-variable(s) T (actual and formal argument lists differ in length) [INFO] 1 error [INFO] ------------------------------------------------------------- : :
    • Release Notes
    • 2021 Week 07-09 (from Feb 15)
    • +

    Description

      Building a rule written in MVEL dialect like (*1) using AND in source pattern of accumulate like (*1-1) in executable rule model, a compilation error (*2) occurs. This issue does not occur when we build the rule with executable model disabled.

      (*1)

      package com.example.reproducer
      
      import java.math.BigDecimal
      
      dialect "mvel"
      
      rule "rule7a2"
          when
              $total : BigDecimal() from accumulate( $car : Car( discontinued == true ) and Order( item == $car, $price : price ),    // ..... (*1-1)
                                                     init( BigDecimal total = BigDecimal.ZERO; ),
                                                     action( total += $price; ),
                                                     reverse( total -= $price; ),
                                                     result( total ) )
          then
              System.out.println("***** Action of rule7a2 -- $total = " + $total);
      end
      

      (*2)

      [ERROR] /work2/testdir/reproducer_model_compiler_7a/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rulese69ee9f6a2a84acaa675792cae099156RuleMethods0.java:[28,63] method accumulate in class org.drools.model.DSL cannot be applied to given types;
        required: org.drools.model.view.ViewItem<?>,org.drools.model.functions.accumulate.AccumulateFunction,org.drools.model.functions.accumulate.AccumulateFunction[]
        found: org.drools.model.view.ViewItem
        reason: cannot infer type-variable(s) T
          (actual and formal argument lists differ in length)
      

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              rhn-support-myoshida Masato Yoshida
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: