]
Luca Molteni updated DROOLS-5954:
---------------------------------
Sprint: 2020 Week 52-03 (from Dec 21) (was: 2021 Week 04-06 (from Jan 25))
Variable binding of a Map element causes compilation errors in
executable model.
--------------------------------------------------------------------------------
Key: DROOLS-5954
URL:
https://issues.redhat.com/browse/DROOLS-5954
Project: Drools
Issue Type: Bug
Components: executable model
Reporter: Luca Molteni
Assignee: Luca Molteni
Priority: Major
Labels: support
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)
{noformat}
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
{noformat}
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
{noformat}
[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
{noformat}
(\*2-2) Error messages on RHDM 7.7.0 to 7.7.1
{noformat}
[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))
{noformat}
(\*2-3) Error messages on RHDM 7.8.0 to 7.9.0
{noformat}
[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
{noformat}