[rules-dev] Drools 5.2.0: basic grammar problems

ljnelson ljnelson at gmail.com
Wed Mar 23 12:39:46 EDT 2011


This (stupid, unit test) rule:

rule "Testing contains"
  dialect "mvel"
  when
    Response( $answerSelections : answerSelections )
    AnswerSelection( answer.ID in (2, 3) )
  then
    System.out.println("Testing contains activated")
end

Produces this error:

java.lang.AssertionError: KnowledgeBuilder errors:
Unable to Analyse Expression answer.ID == 2 || answer.ID == 3:
[Error: Failed to compile: 1 compilation error(s): 
 - (1,9) unqualified type in strict mode for: ID]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0] : [Rule name='Testing contains']

Note the implicit rewrite going on.  Clearly contains() is getting rewritten
internally to a long disjunctive (x == 1 || x == 2 || x == 3 and so on). 
For whatever reason, in Drools 5.2.0-SNAPSHOT, this runs afoul of MVEL's
strict mode, which if I'm understanding things properly shouldn't be visible
to the .drl developer.

I know that Drools 5.2.0-SNAPSHOT is a mess at the moment but wanted to pass
this along.

Best,
Laird

--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-2-0-basic-grammar-problems-tp2721155p2721155.html
Sent from the Drools - Dev mailing list archive at Nabble.com.


More information about the rules-dev mailing list