org.mvel.CompileException: variable already defined within scope
----------------------------------------------------------------
Key: JBRULES-1397
URL:
http://jira.jboss.com/jira/browse/JBRULES-1397
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.3
Reporter: Edson Tirelli
Assigned To: Edson Tirelli
Fix For: 4.0.4, 4.1.0
Reported by Alexander Bagerman.
The following rule and code snippet raises the problem:
rule "rule"
dialect "mvel"
when
$p : Person( $likes : likes )
then
Cheese c = new Cheese( $likes );
System.out.println( $p + " -> " + c );
insert( c );
end
// snippet
Person bob = new Person( "Bob", "stilton" );
Person mark = new Person( "Mark", "brie" );
workingMemory.insert( bob );
workingMemory.insert( mark );
workingMemory.fireAllRules();
The exception is:
Caused by: org.mvel.CompileException: variable already defined within scope: class
com.sample.Cheese c
at org.drools.base.mvel.DroolsMVELFactory.createVariable(DroolsMVELFactory.java:218)
at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira