Details
-
Enhancement
-
Resolution: Done
-
Major
-
None
-
7.58.0.Final
-
None
-
2021 Week 34-36 (from Aug 23)
-
undefined
-
NEW
-
NEW
Description
It's not possible to use variables inside bindings. Here's the reproducer
Executable model should report the error
@Test public void testVariableInsideBinding() { String str = "import " + Person.class.getCanonicalName() + ";" + "import " + NameLengthCount.class.getCanonicalName() + ";" + "rule X when\n" + " $nlc : NameLengthCount() \n" + " Person ( $nameLength : $nlc.getNameLength(name))" + "then\n" + "end"; Results results = createKieBuilder(str ).getResults(); assertThat(results.getMessages(Message.Level.ERROR).stream().map(Message::getText)) .contains("Variables can not be used inside bindings. Variable [$nlc] is being used in binding '$nlc.getNameLength(name)'"); } public static class NameLengthCount { public int getNameLength(String name) { return name.length(); } }
Attachments
Issue Links
- relates to
-
DROOLS-6558 Allow binding of a complex expression using multiple facts
- Open