[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1460) MVEL parser uses wrong precedence for []
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Tue Mar 11 23:48:58 EDT 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1460?page=comments#action_12402327 ]
Mark Proctor commented on JBRULES-1460:
---------------------------------------
Early versions of Drools used Beanshell, years back. Trust me we are far better off without it. I'll ping the MVEL author to see if we can get this fixed for the next MVEL release.
> 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
More information about the jboss-jira
mailing list