+++ This bug was initially created as a clone of Bug #1300692 +++ Description of problem: Platform issue for DROOLS-1037 to fix the following RuntimeException during compilation: java.lang.RuntimeException at org.drools.compiler.rule.builder.PatternBuilder.rewriteCompositeExpressions(PatternBuilder.java:924) at org.drools.compiler.rule.builder.PatternBuilder.rewriteCompositeExpressions(PatternBuilder.java:919) at org.drools.compiler.rule.builder.PatternBuilder.rewriteOrExpressions(PatternBuilder.java:893) at org.drools.compiler.rule.builder.PatternBuilder.buildExpression(PatternBuilder.java:889) at org.drools.compiler.rule.builder.PatternBuilder.buildCcdDescr(PatternBuilder.java:860) at org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:715) at org.drools.compiler.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:580) Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Build a rule with the following LHS: $p : Person( name == null || (name in (\"Alice\", \"Charlie\", \"David\"))==false ) 2. Try to compile the package Actual results: Build fails with RuntimeException Expected results: Build is successful Additional info: Changing the constraint to the following works as well: $p : Person( name == null || (name not in (\"Alice\", \"Charlie\", \"David\")) ) --- Additional comment from JBoss Product and Program Management on 2016-01-21 14:20:19 CET --- Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
Martin, we will fix the runtime exception, but the reported syntax is not a valid DRL syntax: (name in (\"Alice\", \"Charlie\", \"David\"))==false The only accepted syntaxes are x in ("foo", "bar") x not in ("foo", "bar") Mario, can you please add error handling for this scenario?
This syntax is working in BRMS 6.1. In BRMS 6.2, the compiler should emit a WARN message when such an invalid syntax is used, to make users aware that their rules need to be fixed. We could then reject this syntax in BRMS 6.3 or 7, and make sure this is documented in the migration guide. WDYT?
Cherry-picked to 6.3.x branch with https://github.com/droolsjbpm/drools/commit/014f29c15
Verified by running reproducer attached in the Mario's commit.