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

Executable-model build error with "matches" and fuction with a fact property as an argument

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.24.0.Final
    • executable model

      When a rule uses "matches" and class function and its argument is a property of the fact,

      for example)

      import org.drools.modelcompiler.domain.Person;
      import static org.drools.modelcompiler.domain.MyFunctions.*;
      
      rule R when
          $a : Person( name matches testMatch(likes) )
      then
      end
      

      It fails to build in executable-model

      [ERROR] testMatchesClassFunctionWithArg[FLOW_DSL](org.drools.modelcompiler.CompilerTest)  Time elapsed: 0.346 s  <<< ERROR!
      java.lang.IllegalArgumentException: Cannot get expression type by name _this!
      	at org.drools.modelcompiler.builder.generator.DrlxParseUtil.lambda$expressionTypeNameExpr$2(DrlxParseUtil.java:246)
      	at java.util.Optional.orElseThrow(Optional.java:290)
      	at org.drools.modelcompiler.builder.generator.DrlxParseUtil.expressionTypeNameExpr(DrlxParseUtil.java:246)
      	at org.drools.modelcompiler.builder.generator.DrlxParseUtil.getExpressionType(DrlxParseUtil.java:180)
      	at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.processFirstNode(ExpressionTyper.java:549)
      

      It works with non-executable-model.

      Additonal note: When running kie-maven-plugin with -DgenerateModel=YES in 7.23.0.Final-redhat-00002 (RHDM 7.4.0), the error message is "No value present".

      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.23.0.Final-redhat-00002:generateModel (default-generateModel) on project model-map-evaluation-rule: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.23.0.Final-redhat-00002:generateModel failed: No value present -> [Help 1]
      

            mfusco@redhat.com Mario Fusco
            rhn-support-tkobayas Toshiya Kobayashi
            Tibor Zimányi Tibor Zimányi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: