]
Mario Fusco resolved DROOLS-5941.
---------------------------------
Resolution: Done
Fixed by
Order of parameters passed to the method called in accumulate
function action() is unexpectedly changed in executable model.
----------------------------------------------------------------------------------------------------------------------------
Key: DROOLS-5941
URL:
https://issues.redhat.com/browse/DROOLS-5941
Project: Drools
Issue Type: Bug
Components: executable model
Reporter: Mario Fusco
Assignee: Mario Fusco
Priority: Major
Labels: support
Attachments: reproducer_model_compiler_5a.zip
Executing a rule like (\*1) that uses {{action()}} accumulate function in which calls a
method like (\*1-1) in executable model, the order of parameters passed to the method is
unexpectedly changed and the parameters are not passed correctly. For example of the rule
(\*1-1), {{$a.method(map, $bList, $cList, $dList)}} is actually called as {{$a.method(map,
$cList, $aList, $bList)}}.
(\*1)
{noformat}
package com.example.reproducer
import java.util.List
import java.util.Set
import java.util.Map
import java.util.HashMap
dialect "java"
rule "rule5a"
when
$aList : List() from collect( A() )
$bList : List() from collect( B() )
$cList : List() from collect( C() )
$dList : List() from collect( D() )
$eSet : Set() from accumulate( $a : A() from $aList,
init( Map map = new HashMap(); ),
action( $a.method(map, $bList, $cList, $dList); ),
// ..... (*1-1)
result( map.keySet() ) )
then
System.out.println("***** Action of \"rule5a\" -- $aList = "
+ $aList + ", $bList = " + $bList + ", $cList = " + $cList + ",
$dList = " + $dList + ", $eSet = " + $eSet);
end
{noformat}