Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
7.35.0.Final
-
None
-
2020 Week 13-15 (from Mar 23)
-
-
NEW
-
NEW
Description
Executable model rule compilation fails on patters that bind a collection field indexed with square brackets
Example of DRL that fails to compile:
rule "binding field indexed with square brackets" when Pojo($firstItem : integerList[0]) Pojo(integerList[this.integerList.size()-1] == $firstItem) then end
Error:
Message [id=1, level=ERROR, path=src/main/java/org/drools/reproducer/RulesE96881902F91EBF30C7D6404720A1A94RuleMethods0.java, line=29, column=138 text=no suitable method found for bind(org.drools.model.Variable<java.util.Map>,(org.drool[...]et(0)) method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<org.drools.reproducer.Pojo,A>) is not applicable (inference variable A has incompatible bounds equality constraints: java.util.Map lower bounds: java.lang.Integer) method org.drools.model.PatternDSL.PatternDef.<A>bind(org.drools.model.Variable<A>,org.drools.model.functions.Function1<org.drools.reproducer.Pojo,A>,org.drools.model.PatternDSL.ReactOn) is not applicable (cannot infer type-variable(s) A (actual and formal argument lists differ in length)) method org.drools.model.PatternDSL.PatternDef.<A,U>bind(org.drools.model.Variable<A>,org.drools.model.Variable<U>,org.drools.model.functions.Function1<U,A>) is not applicable (cannot infer type-variable(s) A,U (actual and formal argument lists differ in length))
The example works fine when compiling without executable model.
Furthermore, the same example expressed with OOPath fails to compile both with and without executable model:
rule "binding field indexed with square brackets in OOPath" when Pojo($firstItem : /integerList[0]) Pojo(/integerList[this.integerList.size()-1] == $firstItem) then end
Error without executable model:
Message [id=1, kieBase=binding-field-indexed-with-square-brackets, level=ERROR, path=org/drools/reproducer/rules.drl, line=4, column=0 text=Unable to Analyse Expression /integerList[this.integerList.size()-1] == $firstItem: [Error: Missing left node] [Near : {... /integerList[this.integerList.size()-1] == $firstItem ....}]
Error with executable model:
Message [id=1, kieBase=binding-field-indexed-with-square-brackets, level=ERROR, path=org/drools/reproducer/rules.drl, line=-1, column=0 text=Unknown field integerList on class java.lang.Integer]