-
Bug
-
Resolution: Done
-
Major
-
7.38.0.Final
-
None
-
2020 Week 22-24 (from May 25)
-
4
-
NEW
-
NEW
This rule fails with PATTERN_DSL
rule R when accumulate ( $p : Person(), $result : sum( MyUtil.add($p.getAge(), 10) ) ) then insert($result); end
It generates a lambda with duplicated parameters "_this" and "$p" which are the same Pattern input bind variable.
org.drools.model.Rule rule = D.rule("R").build(D.accumulate(D.pattern(var_$p).bind(var_C6D512FA5D3AACA24A83BF1EE132C0B2,
var_$p,
(_this, $p) -> MyUtil.add($p.getAge(),10)),
So fails at runtime
[ERROR] testAccumulateStaticMethodWithPatternBindVar[PATTERN_DSL](org.drools.modelcompiler.AccumulateTest) Time elapsed: 3.151 s <<< ERROR! java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:105) at org.drools.core.phreak.PhreakAccumulateNode.addMatch(PhreakAccumulateNode.java:714) at org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:168) at org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:89) at org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:583) at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:554) at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:381) at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:341) at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:177) at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:135) at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:213) at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88) at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:33) at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43) at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1101) at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1048) at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1040) at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1336) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1327) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1311) at org.drools.modelcompiler.AccumulateTest.testAccumulateStaticMethodWithPatternBindVar(AccumulateTest.java:2058) ... Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 at org.drools.model.view.BindViewItem2.eval(BindViewItem2.java:89) at org.drools.modelcompiler.constraints.BindingEvaluator.evaluate(BindingEvaluator.java:39) at org.drools.modelcompiler.constraints.BindingEvaluator.evaluate(BindingEvaluator.java:35) at org.drools.modelcompiler.constraints.LambdaAccumulator$BindingAcc.getAccumulatedObject(LambdaAccumulator.java:146) at org.drools.modelcompiler.constraints.LambdaAccumulator.accumulate(LambdaAccumulator.java:86) at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:97) ... 53 more
- is incorporated by
-
DROOLS-5379 Add more accumulate with static method tests
- Closed