[jboss-jira] [JBoss JIRA] (JBRULES-3292) Parser doesn't accept mvel BigInteger and BigDecimal literals in LHS
RH Bugzilla Integration (Updated) (JIRA)
jira-events at lists.jboss.org
Fri Nov 18 00:14:40 EST 2011
[ https://issues.jboss.org/browse/JBRULES-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
RH Bugzilla Integration updated JBRULES-3292:
---------------------------------------------
Bugzilla References: https://bugzilla.redhat.com/show_bug.cgi?id=754893
> Parser doesn't accept mvel BigInteger and BigDecimal literals in LHS
> --------------------------------------------------------------------
>
> Key: JBRULES-3292
> URL: https://issues.jboss.org/browse/JBRULES-3292
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-compiler
> Affects Versions: 5.2.0.Final, 5.3.0.Final
> Reporter: Toshiya Kobayashi
> Assignee: Mark Proctor
>
> Drools 5.2.0/5.3.0 throws a parse error against the following rule while 5.1.0 can parse it. FactA.value is a BigDecimal.
> {code}
> rule "99.99B"
> dialect "mvel"
> when
> $a : FactA( value == (99.99B) )
> then
> System.out.println( "Hit 99.99B : " + $a.value.toString() );
> end
> {code}
> {noformat}
> [8,23]: [ERR 101] Line 8:23 no viable alternative at input '(' in rule "99.99B"
> [0,0]: Parser returned a null Package
> java.lang.IllegalArgumentException: Could not parse knowledge.
> at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)
> at com.sample.DroolsTest.main(DroolsTest.java:25)
> {noformat}
> Attached an example which includes DroolsTest.java/Sample.drl which demonstrates this. MvelTest.java demonstrates mvel itself works as expected.
> Note from Edson:
> {noformat}
> The short answer is: Drools 5.2 does not support the literal sufixes B for BigDecimal and I for BigInteger.
> The long answer is: Drools is implementing more strict semantics for compilation, in order to provide better feedback at compile time reducing errors at runtime. Up to Drools 5.1, anything between () in an expression was ignored by Drools and passed through to the underlying expression evaluator (MVEL). MVEL has support for B and I sufixes.
> Drools 5.2 improved the parser in order to own 100% of the DRL syntax and now it does not bypass anything in a DRL file. This has advantages and disadvantages, one of which is that if it is not in the DRL grammar, it will not compile, as Drools can not guarantee the runtime semantics of it.
> {noformat}
> So this is an intentional change but I'm setting 'Type:' to "Bug" rather than "Feature Request" as it prevents users from migrating from older version.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list