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

Variable binding of a Map element causes compilation errors in executable model.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.10.1.GA
    • 7.5.0.GA, 7.5.1.GA, 7.6.0.GA, 7.7.0.GA, 7.7.1.GA, 7.8.0.GA, 7.8.1.GA, 7.9.0.GA
    • BRE
    • This issue is found on RHDM 7.5.0 to RHDM 7.9.0.

    • False
    • False
    • Release Notes
    • CR1
    • +
    • Undefined
    • Hide
      • Extract reproducer.
        $ unzip reproducer_mc_1a1_1a2.zip
        $ cd reproducer_mc_1a1_1a2
        
      • Build using RHDM 7.6.0 libraries.
        $ ./run_mvn_rhdm760    # mvn clean compile exec:exec -DgenerateModel=YES -Dba.bom.version=7.6.0.redhat-00004 -Dba.library.version=7.30.0.Final-redhat-00003
            :
            :
        [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 ---
        [INFO] Changes detected - recompiling the module!
        [INFO] Compiling 6 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,86] incompatible types: inference variable A has incompatible bounds
            equality constraints: java.util.Map
            lower bounds: java.lang.Object
        [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,61] method build in class org.drools.model.impl.RuleBuilder cannot be applied to given types;
          required: org.drools.model.RuleItemBuilder<?>[]
          found: <any>,org.drools.model.consequences.ConsequenceBuilder._2<com.example.reproducer.Car,java.util.Map>
          reason: varargs mismatch; inference variable A has incompatible bounds
              equality constraints: java.util.Map
              lower bounds: java.lang.Object
        [INFO] 2 errors 
        [INFO] -------------------------------------------------------------
            :
            :
        
      • Build using RHDM 7.7.1 libraries.
        $ ./run_mvn_rhdm771    # mvn clean compile exec:exec -DgenerateModel=YES -Dba.bom.version=7.7.1.redhat-00002 -Dba.library.version=7.33.0.Final-redhat-00003
            :
            :
        [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 ---
        [INFO] Changes detected - recompiling the module!
        [INFO] Compiling 5 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules4931e491d49648edb0d8704c825666f7RuleMethods0.java:[27,80] no suitable method found for bind(org.drools.model.Variable<java.util.Map>,(com.examp[...]ber"))
            method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>) is not applicable
              (inference variable A has incompatible bounds
                equality constraints: java.util.Map
                lower bounds: java.lang.String)
            method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
              (cannot infer type-variable(s) A
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>) is not applicable
              (cannot infer type-variable(s) A,U
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
              (cannot infer type-variable(s) A,U
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>) is not applicable
              (cannot infer type-variable(s) A,U
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
              (cannot infer type-variable(s) A,U
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>) is not applicable
              (cannot infer type-variable(s) A,U,V
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
              (cannot infer type-variable(s) A,U,V
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>) is not applicable
              (cannot infer type-variable(s) A,U,V,W
                (actual and formal argument lists differ in length))
            method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
              (cannot infer type-variable(s) A,U,V,W
                (actual and formal argument lists differ in length))
        [INFO] 1 error
        [INFO] -------------------------------------------------------------
            :
            :
        
      • Build using RHDM 7.9.0 libraries.
        $ ./run_mvn    # mvn clean compile exec:exec -DgenerateModel=YES
            :
            :
        [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 ---
        [INFO] Changes detected - recompiling the module!
        [INFO] Compiling 7 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PBE/LambdaExtractorBE8AE82BEE077650A708E067B870D9AE.java:[17,45] incompatible types: java.lang.Object cannot be converted to java.util.Map
        [INFO] 1 error
        [INFO] -------------------------------------------------------------
            :
            :
        
      Show
      Extract reproducer. $ unzip reproducer_mc_1a1_1a2.zip $ cd reproducer_mc_1a1_1a2 Build using RHDM 7.6.0 libraries. $ ./run_mvn_rhdm760 # mvn clean compile exec:exec -DgenerateModel=YES -Dba.bom.version=7.6.0.redhat-00004 -Dba.library.version=7.30.0.Final-redhat-00003 : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,86] incompatible types: inference variable A has incompatible bounds equality constraints: java.util.Map lower bounds: java.lang.Object [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,61] method build in class org.drools.model.impl.RuleBuilder cannot be applied to given types; required: org.drools.model.RuleItemBuilder<?>[] found: <any>,org.drools.model.consequences.ConsequenceBuilder._2<com.example.reproducer.Car,java.util.Map> reason: varargs mismatch; inference variable A has incompatible bounds equality constraints: java.util.Map lower bounds: java.lang.Object [INFO] 2 errors [INFO] ------------------------------------------------------------- : : Build using RHDM 7.7.1 libraries. $ ./run_mvn_rhdm771 # mvn clean compile exec:exec -DgenerateModel=YES -Dba.bom.version=7.7.1.redhat-00002 -Dba.library.version=7.33.0.Final-redhat-00003 : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules4931e491d49648edb0d8704c825666f7RuleMethods0.java:[27,80] no suitable method found for bind(org.drools.model.Variable<java.util.Map>,(com.examp[...]ber")) method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>) is not applicable (inference variable A has incompatible bounds equality constraints: java.util.Map lower bounds: java.lang.String) method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>) is not applicable (cannot infer type-variable(s) A,U (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A,U (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>) is not applicable (cannot infer type-variable(s) A,U (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A,U (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>) is not applicable (cannot infer type-variable(s) A,U,V (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A,U,V (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>) is not applicable (cannot infer type-variable(s) A,U,V,W (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A,U,V,W (actual and formal argument lists differ in length)) [INFO] 1 error [INFO] ------------------------------------------------------------- : : Build using RHDM 7.9.0 libraries. $ ./run_mvn # mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile-1) @ reproducer_mc_1a1_1a2 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to /work2/testdir/reproducer_mc_1a1_1a2/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PBE/LambdaExtractorBE8AE82BEE077650A708E067B870D9AE.java:[17,45] incompatible types: java.lang.Object cannot be converted to java.util.Map [INFO] 1 error [INFO] ------------------------------------------------------------- : :
    • 2020 Week 52-03 (from Dec 21), 2021 Week 07-09 (from Feb 15)

      Building a rule written in MVEL dialect like (*1) that accesses to a Map element and bind the value to a variable (*1-1) in executable rule model, compilation errors occur. The error messages are varied depending on RHDM version. (*2-1), (*2-2), (*2-3) are the error messages on 7.5.0 to 7.6.0, 7.7.0 to 7.7.1, 7.8.0 to 7.9.0 respectively.

      (*1)

      package com.example.reproducer
      
      import com.example.reproducer.Car
      
      dialect "mvel"
      
      
      rule "rule1a1"
          when
              $car : Car( $spec : specifications["transmission"] )    // ..... (*1-1)
          then
              System.out.println("***** Action of rule1a1");
              System.out.println("***** $car: " + $car + ", transmission specification = " + $spec);
      end
      

      Where specifications is a Map<String, Object> type property. Even if the type is Map<String, String> (rule "rule1a2" in Sample.drl), the same error occurs as well.

      (*2-1) Error messages on RHDM 7.5.0 to 7.6.0

      [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,86] incompatible types: inference variable A has incompatible bounds
          equality constraints: java.util.Map
          lower bounds: java.lang.Object
      [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules99a3451765bf47d5beed5aa17ec5250eRuleMethods0.java:[27,61] method build in class org.drools.model.impl.RuleBuilder cannot be applied to given types;
        required: org.drools.model.RuleItemBuilder<?>[]
        found: <any>,org.drools.model.consequences.ConsequenceBuilder._2<com.example.reproducer.Car,java.util.Map>
        reason: varargs mismatch; inference variable A has incompatible bounds
            equality constraints: java.util.Map
            lower bounds: java.lang.Object
      

      (*2-2) Error messages on RHDM 7.7.0 to 7.7.1

      [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/Rules4931e491d49648edb0d8704c825666f7RuleMethods0.java:[27,80] no suitable method found for bind(org.drools.model.Variable<java.util.Map>,(com.examp[...]ber"))
          method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>) is not applicable
            (inference variable A has incompatible bounds
              equality constraints: java.util.Map
              lower bounds: java.lang.String)
          method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<com.example.reproducer.Car,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
            (cannot infer type-variable(s) A
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>) is not applicable
            (cannot infer type-variable(s) A,U
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
            (cannot infer type-variable(s) A,U
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>) is not applicable
            (cannot infer type-variable(s) A,U
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function2<com.example.reproducer.Car,U,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
            (cannot infer type-variable(s) A,U
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>) is not applicable
            (cannot infer type-variable(s) A,U,V
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U,V>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.functions.Function3<com.example.reproducer.Car,U,V,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
            (cannot infer type-variable(s) A,U,V
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>) is not applicable
            (cannot infer type-variable(s) A,U,V,W
              (actual and formal argument lists differ in length))
          method org.drools.model.PatternDSL.PatternDef.<A,U,V,W>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.Variable<V>,org.drools.model.Variable<W>,org.drools.model.functions.Function4<com.example.reproducer.Car,U,V,W,A>,org.drools.model.PatternDSL.ReactOn) is not applicable
            (cannot infer type-variable(s) A,U,V,W
              (actual and formal argument lists differ in length))
      

      (*2-3) Error messages on RHDM 7.8.0 to 7.9.0

      [ERROR] /work2/testdir/reproducer_mc_1a1_1a2/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PBE/LambdaExtractorBE8AE82BEE077650A708E067B870D9AE.java:[17,45] incompatible types: java.lang.Object cannot be converted to java.util.Map
      

              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: