[
http://jira.jboss.com/jira/browse/JBRULES-1460?page=comments#action_12402483 ]
Godmar Back commented on JBRULES-1460:
--------------------------------------
However the reasoning behind the choice of MVEL may be, as of now, I've suspended my
work with Drools hoping for a more stable parser.
I had sent Ed off-JIRA two fully-self contained test setups where Drools/MVEL runs out of
memory. Due to the nature of the code involved, I don't want to post them publicly.
I also think the following case still fails (reported under
http://jira.jboss.com/jira/browse/JBRULES-1461 - though I was mistaken to attribute this
problem in that JIRA to the wrong MVEL version, it occurs with the blessed one as well.)
--
package test;
dialect "mvel"
rule "Rule #1"
when
then
System.out.println("now computing 1+1...");
Integer two = new Integer(2);
System.out.println(two);
end
--
Thanks.
MVEL parser uses wrong precedence for []
----------------------------------------
Key: JBRULES-1460
URL:
http://jira.jboss.com/jira/browse/JBRULES-1460
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.4
Reporter: Godmar Back
Consider this .drl file:
--
package test;
import java.util.ArrayList;
import java.util.HashMap;
dialect "mvel"
rule "Rule #1"
when
then
m = new HashMap();
l = new ArrayList();
l.add("first");
m.put("content", l);
System.out.println(m["content"][0]);
end
---
which produces:
org.mvel.PropertyAccessException: unable to resolve property:
out.println(m["content"][0])
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:285)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:107)
at
org.mvel.ast.LiteralDeepPropertyNode.getReducedValueAccelerated(LiteralDeepPropertyNode.java:26)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel.MVEL.executeExpression(MVEL.java:223)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:471)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at org.libx.autodetect.DroolsDriver$Host.fireAllRules(DroolsDriver.java:63)
at org.libx.autodetect.DroolsDriver.main(DroolsDriver.java:135)
Caused by: org.mvel.PropertyAccessException: unable to resolve property: unable to
resolve method: java.io.PrintStream.println(java.util.ArrayList, org.mvel.util.FastList)
[arglength=2]
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:558)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:257)
... 12 more
Exception in thread "main" org.drools.spi.ConsequenceException:
org.mvel.PropertyAccessException: unable to resolve property:
out.println(m["content"][0])
at
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:14)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:471)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at org.libx.autodetect.DroolsDriver$Host.fireAllRules(DroolsDriver.java:63)
at org.libx.autodetect.DroolsDriver.main(DroolsDriver.java:135)
Caused by: org.mvel.PropertyAccessException: unable to resolve property:
out.println(m["content"][0])
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:285)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:107)
at
org.mvel.ast.LiteralDeepPropertyNode.getReducedValueAccelerated(LiteralDeepPropertyNode.java:26)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel.MVEL.executeExpression(MVEL.java:223)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
... 5 more
Caused by: org.mvel.PropertyAccessException: unable to resolve property: unable to
resolve method: java.io.PrintStream.println(java.util.ArrayList, org.mvel.util.FastList)
[arglength=2]
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:558)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:257)
... 12 more
but changing:
System.out.println(m["content"][0]);
to
System.out.println((m["content"])[0]);
works. (So does assigning m["content"] to a temporary variable.)
BTW: if you say that's a MVEL issue, not a Drools issue, consider that I have no
other reason to use MVEL than to be able to use Drools. That's why I filed this bug
here. I don't know how to run MVEL in any other environment, nor am I interested in it
- I'd rather use a mature scripting language (beanshell comes to mind) that
doesn't exhibit such basic bugs. Why don't you?
--
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