[
https://issues.jboss.org/browse/JBRULES-2918?page=com.atlassian.jira.plug...
]
Mark Proctor resolved JBRULES-2918.
-----------------------------------
Fix Version/s: 5.2.0.CR1
Resolution: Done
I updated some tests to follow your example, but they passed. I'm committing those to
catch any future regressions.
MVEL issue - inline with broken since 5.0.1
-------------------------------------------
Key: JBRULES-2918
URL:
https://issues.jboss.org/browse/JBRULES-2918
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler
Affects Versions: 5.1.0.FINAL, 5.1.1.FINAL
Reporter: Damon Horrell
Assignee: Mark Proctor
Fix For: 5.2.0.CR1
Rules that used to compile in 5.0.1 no longer do in 5.1.1. The MVEL "inline with
operator" now doesn't support accessing objects in an outer scope.
I have tried using Drools 5.1.1 with MVEL 2.0.10 but the error is still the same so the
problem seems to be in Drools not in MVEL.
------------
rule "create person"
dialect "mvel"
when
raw : Map();
then
person = new TestPerson().{
name = raw["First Name"] + " " + raw["Last Name"],
dateOfBirth = stringToDate(raw["DOB"])
};
insert(person);
end
------------
Caused by: [Error: unable to resolve method:
au.com.rpdata.processor.data.TestPerson.raw() [arglength=0]]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:932)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:592)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionProperty(ReflectiveAccessorOptimizer.java:609)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:317)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:137)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:137)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:111)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:111)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:37)
at org.mvel2.optimizers.impl.refl.nodes.WithAccessor.processWith(WithAccessor.java:64)
at org.mvel2.optimizers.impl.refl.nodes.WithAccessor.getValue(WithAccessor.java:50)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getWithProperty(ReflectiveAccessorOptimizer.java:409)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:320)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileConstructor(ReflectiveAccessorOptimizer.java:1141)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeObjectCreation(ReflectiveAccessorOptimizer.java:1070)
at org.mvel2.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.java:160)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:37)
at org.mvel2.ast.AssignmentNode.getReducedValueAccelerated(AssignmentNode.java:89)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
at org.mvel2.MVEL.executeExpression(MVEL.java:1001)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:103)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
au.com.rpdata.processor.impl.DroolsMapTransformer.transform(DroolsMapTransformer.java:110)
... 29 more
------
Can you please advise if there is a syntax workaround to inform the compiler that the
object referred to is in a different scope?
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira