]
Ciprian Chiru commented on DROOLS-5641:
---------------------------------------
For any additional questions related to this bug report, please address [~erikwiklander]
Compilation fails when chaining methods with function calls as
params
---------------------------------------------------------------------
Key: DROOLS-5641
URL:
https://issues.redhat.com/browse/DROOLS-5641
Project: Drools
Issue Type: Bug
Components: executable model
Affects Versions: 7.43.0.Final
Reporter: Ciprian Chiru
Assignee: Luca Molteni
Priority: Major
Given the following rule:
{code:java}
global java.util.Set controlSet;
global org.example.drools.service.DummyService dummyService;
declare A
x: String
end
rule "will execute per each Measurement having ID color"
no-loop
when
$m: Measurement( id == "color", $colorVal : val )
$a: A()
String() from dummyService.dummy($m.getSomethingBy($a.x), $a)
then
controlSet.add($colorVal);
end{code}
The compilation fails with:
{code:java}
[...]/target/generated-sources/drools-model-compiler/main/java/rules/Rules7ad4e52deb9d4184b7d7e4646c172273RuleMethods0.java:[27,111]
no suitable method found for
from(org.drools.model.Global<org.example.drools.service.DummyService>,org.drools.model.Variable<rules.A>,org.drools.model.Variable<org.example.drools.model.Measurement>,rules.P45.LambdaExtractor4580D2619F79AA1C0CC3F15809293690)
[ERROR] method org.drools.model.DSL.<T>from(T) is not applicable
[ERROR] (cannot infer type-variable(s) T
[ERROR] (actual and formal argument lists differ in length))
[ERROR] method org.drools.model.DSL.<T>from(org.drools.model.Variable<T>) is
not applicable
[ERROR] (cannot infer type-variable(s) T
[ERROR] (actual and formal argument lists differ in length))
[ERROR] method
org.drools.model.DSL.<T>from(org.drools.model.functions.Function0<T>) is not
applicable
[ERROR] (cannot infer type-variable(s) T
[ERROR] (actual and formal argument lists differ in length))
[ERROR] method
org.drools.model.DSL.<T>from(org.drools.model.Variable<T>,org.drools.model.functions.Function1<T,?>)
is not applicable
[ERROR] (cannot infer type-variable(s) T
[ERROR] (actual and formal argument lists differ in length))
[ERROR] method
org.drools.model.DSL.<A,B>from(org.drools.model.Variable<A>,org.drools.model.Variable<B>,org.drools.model.functions.Function2<A,B,?>)
is not applicable
[ERROR] (cannot infer type-variable(s) A,B
[ERROR] (actual and formal argument lists differ in length))
[ERROR] method
org.drools.model.DSL.<A,B,C>from(org.drools.model.Variable<A>,org.drools.model.Variable<B>,org.drools.model.Variable<C>,org.drools.model.functions.Function3<A,B,C,?>)
is not applicable
[ERROR] (inference variable B has incompatible equality constraints
org.example.drools.model.Measurement,rules.A)
[ERROR] method
org.drools.model.DSL.<A,B,C,D>from(org.drools.model.Variable<A>,org.drools.model.Variable<B>,org.drools.model.Variable<C>,org.drools.model.Variable<D>,org.drools.model.functions.Function4<A,B,C,D,?>)
is not applicable
[ERROR] (cannot infer type-variable(s) A,B,C,D
[ERROR] (actual and formal argument lists differ in length)){code}
This error is reproducible with the latest _7.44.0-SNAPSHOT_ .
The parameters are flipped between the LambdaExtractor and the RuleMethods generated
classes.