Hi<div>I&#39;ve inherited some old code running under 4.x of Drools. I&#39;m investigating use of 5.1.0 for newer development.</div><div>I was testing the old code base as is with drools 5.1.0 and got some compilation issues on the DRL. Here is the sample drl snippet</div>
<div><br></div><div>package com.test.rule </div><div>import ...</div><div><br clear="all"><div>rule &quot;EmailVerificationCheck&quot;</div><div>salience 500</div><div>when</div><div>   context  : RuleContext (paymentMethod == &quot;P_EXPRESS&quot;)</div>
<div>   eval (!context.isTrustedUser())</div><div>   act      : RuleAction (action == null || == &quot;VERIFY&quot;)</div><div>then</div><div>   if (act.getAction() == null) {</div><div>      if(!context.isPEmailVerified()) {</div>
<div>         act.setAction (&quot;VERIFY&quot;);</div><div>      }</div><div>   }</div><div><br></div><div>   if (act.getAction() == &quot;VERIFY&quot;) {</div><div>      if(!context.isPEmailVerified()) {</div><div>        act.getRuleNames().add(&quot;PEmailVerificationCheck&quot;);</div>
<div>      }</div><div>   }</div><div>end</div><div><br></div>Compilation error is at eval (!context.isTrustedUser()) and the error message is as follows -</div><div><br></div><div><div><div>org.drools.rule.InvalidRulePackage: Unable to generate rule invoker. : org.drools.lang.descr.EvalDescr@1f8b158</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>com/playspan/rule/Rule_PayPal_EmailVerificationCheck_0Eval0Invoker.java (16:48) : Redefinition of local variable &quot;context&quot; </div><div><br></div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.rule.Package.checkValidity(Package.java:477) ~[drools-core-5.1.0.jar:5.1.0]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:479) ~[drools-core-5.1.0.jar:5.1.0]</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:445) ~[drools-core-5.1.0.jar:5.1.0]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:452) ~[drools-core-5.1.0.jar:5.1.0]</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>at com.playspan.rule.RuleEngine.buildRuleBase(RuleEngine.java:374) [classes/:na]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at com.playspan.rule.RuleEngine.initializeRuleSession(RuleEngine.java:384) [classes/:na]</div>
</div></div><div><br></div><div>It is using java dialect and JANINO compiler.</div><div><br></div><div>I would really appreciate if some could point me to a direction for troubleshooting this issue.</div><div><br></div><div>
Is this construct invalid for 5.x onwards?</div><div><br></div><div>Thanks</div><div>Kumar</div>