Compilation error occurs for rules written in MVEL dialect and using the enhanced "for" (foreach) statement in executable model.
Issue
Building rules written in MVEL dialect and using the enhanced for
(foreach) statement with executable rule model enabled causes an error.
When I build a maven project which contains rules using the enhanced for
statement like (*1) with executable model enabled,
package com.example.reproducer
import java.util.ArrayList
import com.example.reproducer.Bus
dialect "mvel"
rule "bus1"
when
$buses : ArrayList() from collect ( Bus() )
then
for ( Bus : $buses ) { // ..... (*1)
System.out.println("bus: " + bus);
}
end
build error occurs at the enhanced for
statement with the messages like below.
$ mvn clean compile -DgenerateModel=YES
...
[ERROR] Unable to build KieBaseModel:rules
CompilationProblemErrorResult: org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) {
System.out.println("bus: " + bus);
} failed.
...
Environment
- Red Hat Decision Manager (RHDM)
- 7.5.0 - 7.9.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.