]
Luca Molteni updated DROOLS-5609:
---------------------------------
Sprint: 2020 Week 34-36 (from Aug 17)
Cannot use as parameter of a function the result of another function
receiving a parameter of its own
-----------------------------------------------------------------------------------------------------
Key: DROOLS-5609
URL:
https://issues.redhat.com/browse/DROOLS-5609
Project: Drools
Issue Type: Bug
Components: executable model
Affects Versions: 7.42.0.Final
Reporter: Ciprian Chiru
Assignee: Luca Molteni
Priority: Major
Given the following rule:
{code:java}
import java.util.*;
global java.util.Set controlSet;
global org.example.drools.service.DummyService dummyService;
rule "will execute per each Measurement having ID color"
no-loop
when
Measurement( id == "color", $colorVal : val )
String() from dummyService.dummy(dummyService.dummy($colorVal))
then
controlSet.add($colorVal);
end{code}
The compilation fails with:
{code:java}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile-1) on
project rules: Compilation failure
[ERROR]
.../target/generated-sources/drools-model-compiler/main/java/rules/Rules38bbab4141b64289855d5e28d5f95ca6RuleMethods0.java:[24,111]
no suitable method found for
from(org.drools.model.Global<org.example.drools.service.DummyService>,org.drools.model.Global<org.example.drools.service.DummyService>,org.drools.model.Variable<java.lang.String>,rules.P4C.LambdaExtractor4CA52645EC5319D0363A23796D4739AE)
[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] (cannot infer type-variable(s) A,B,C
[ERROR] (argument mismatch; rules.P4C.LambdaExtractor4CA52645EC5319D0363A23796D4739AE
cannot be converted to org.drools.model.functions.Function3<A,B,C,?>))
[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 can be reproduced with version _7.43.0-SNAPSHOT_