Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5609

Cannot use as parameter of a function the result of another function receiving a parameter of its own

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.42.0.Final
    • Fix Version/s: None
    • Component/s: executable model
    • Labels:
      None
    • Sprint:
      2020 Week 34-36 (from Aug 17)
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Given the following rule:

       

      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

       

      The compilation fails with:

      [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))

      This error can be reproduced with version 7.43.0-SNAPSHOT

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                lucamolteni Luca Molteni
                Reporter:
                cchiru Ciprian Chiru
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: