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

Compiler error in executable model when there is a clash between a field and a class name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • 2019 Week 05-07
    • NEW
    • NEW

      [ERROR] Unable to build KieBaseModel:rules
      InvalidExpressionErrorResult: Unknown field HELLO on class java.lang.String
      InvalidExpressionErrorResult: Unknown field GOODBYE on class java.lang.String

      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 5.207 s
      [INFO] Finished at: 2019-01-28T18:10:43+09:00
      [INFO] Final Memory: 64M/657M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.14.0.Final-redhat-00002:generateModel (default-generateModel) on project HelloWorld: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.14.0.Final-redhat-00002:generateModel failed: Unable to get KieModule, Errors Existed: Error Messages:
      [ERROR] Message [id=1, kieBase=rules, level=ERROR, path=com/sample/Sample.drl, line=-1, column=0
      [ERROR] text=Unknown field HELLO on class java.lang.String]
      [ERROR] Message [id=2, kieBase=rules, level=ERROR, path=com/sample/Sample.drl, line=-1, column=0
      [ERROR] text=Unknown field GOODBYE on class java.lang.String]
      [ERROR]
      [ERROR] Warning Messages:
      [ERROR]
      [ERROR] Info Messages:
      ...

      Here is problematic DRL.

      package com.sample
      
      import com.sample.Message;
      
      rule "Hello World"
          when
              m : Message( status == Message.HELLO, myMessage : message )
          then
              System.out.println( myMessage );
              m.setMessage( "Goodbye cruel world" );
              m.setStatus( Message.GOODBYE );
              update( m );
      end
      
      rule "GoodBye"
          when
              Message( status == Message.GOODBYE, myMessage : message )
          then
              System.out.println( myMessage );
      end
      

              mfusco@redhat.com Mario Fusco
              mfusco@redhat.com Mario Fusco
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: