Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1513

The enhanced "for" (foreach) statement causes compilation error in executable models.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.10.0.GA
    • 7.9.0.GA
    • BRE
    • RHDM 7.9.0.

    • False
    • False
    • Release Notes
    • CR1
    • +
    • Undefined
    • Hide
      $ unzip reproducer_02801729_1a.zip
      $ cd reproducer_02801729_1a
      $ mvn clean compile exec:exec    # or mvn clean compile exec:exec -DgenerateModel=YES
          :
          :
      [INFO] --- kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel (default-generateModel) @ reproducer_02801729_1a ---
          :
          :
      [ERROR] Unable to build KieBaseModel:rules
      CompilationProblemErrorResult: org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) {
          System.out.println("bus: " + bus);
      } failed.
      
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  2.776 s
      [INFO] Finished at: 2020-11-20T01:02:26+09:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel (default-generateModel) on project reproducer_02801729_1a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel failed: Unable to get KieModule, Errors Existed: Error Messages:
      [ERROR] Message [id=1, kieBase=rules, level=ERROR, path=com/example/reproducer/Sample.drl, line=0, column=0
      [ERROR]    text=org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) {
      [ERROR]     System.out.println("bus: " + bus);
      [ERROR] } failed.]
      [ERROR] ---
      [ERROR] Warning Messages:
      [ERROR] ---
      [ERROR] Info Messages:
      [ERROR] 
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
      
      Show
      $ unzip reproducer_02801729_1a.zip $ cd reproducer_02801729_1a $ mvn clean compile exec:exec # or mvn clean compile exec:exec -DgenerateModel=YES : : [INFO] --- kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel (default-generateModel) @ reproducer_02801729_1a --- : : [ERROR] Unable to build KieBaseModel:rules CompilationProblemErrorResult: org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) { System.out.println("bus: " + bus); } failed. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.776 s [INFO] Finished at: 2020-11-20T01:02:26+09:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel (default-generateModel) on project reproducer_02801729_1a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.44.0.Final-redhat-00003:generateModel failed: Unable to get KieModule, Errors Existed: Error Messages: [ERROR] Message [id=1, kieBase=rules, level=ERROR, path=com/example/reproducer/Sample.drl, line=0, column=0 [ERROR] text=org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) { [ERROR] System.out.println("bus: " + bus); [ERROR] } failed.] [ERROR] --- [ERROR] Warning Messages: [ERROR] --- [ERROR] Info Messages: [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
    • 2020 Week 49-51 (from Nov 30)

      Compiling a rule like (*1) which is described in MVEL dialect and contains the enhanced "for" (foreach) statement in the action part with executable rule models enabled, compilation error like (*2) occurs at the enhanced "for" statement.

      (*1)

      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 ) {
                  System.out.println("bus: " + bus);
              }
      end
      

      (*2)

      [ERROR] Unable to build KieBaseModel:rules
      CompilationProblemErrorResult: org.drools.mvelcompiler.MvelCompilerException: Type check of for (Bus bus : $buses) {
       System.out.println("bus: " + bus);
      } failed.
      

              lmolteni@redhat.com Luca Molteni
              rhn-support-myoshida Masato Yoshida
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: