Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6298

for-each for the property of fact causes compilation error in executable models.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.52.0.Final
    • executable model
    • 2021 Week 16-18 (from Apr 19), 2021 Week 19-21 (from May 10)
    • Hide

      run attached reproducer by the following command :
      mvn clean compile exec:exec

      But it works by the following command :
      mvn clean compile exec:exec -DgenerateModel=NO

      Show
      run attached reproducer by the following command : mvn clean compile exec:exec But it works by the following command : mvn clean compile exec:exec -DgenerateModel=NO
    • Hide

      use getter in for-each statement like the following

      for(Object $o: $fact.getObjects()){

      Show
      use getter in for-each statement like the following for(Object $o: $fact.getObjects()){
    • Undefined
    • NEW
    • NEW

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

      (*1)

      dialect "mvel"
      
      rule "rule_for_each"
          when
              $fact : Fact( )
          then
              for(Object $o: $fact.objects){
                  System.out.println("***** Object: " + $o);
              }
      end
      

      (*2)

      [ERROR] /path/to/reproducer_for_each_mvel/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/P38/LambdaConsequence38AC43B3394F7F01FE2963E5C1446FBD.java:[25,31] objects has private access in com.example.reproducer.Fact
      

              lmolteni@redhat.com Luca Molteni
              rhn-support-hmiura Hiroko Miura
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: