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

Incorrect resolution of global symbols in LHS rule constraint (Java dialect)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 6.1.0.Beta1
    • None
    • None
    • None

    Description

      As described @ http://drools.46999.n3.nabble.com/Incorrect-resolution-of-global-symbols-in-LHS-rule-constraint-Java-dialect-tp4027921.html.

      I upgraded from 5.5.0.Final of Drools (rule engine) to 5.6.0.Final and I am now seeing errors with globals.

      We have rule constraints that access globals in a DRL; like this:

      some.classpath.package2.MyType ( global_instance.invoke(this) == true ) 

      I have

      some.classpath.package.SomeType global_instance;

      declared at the top of the DRL, but it doesn't seem to be interpreting it as a global in the rule's restriction.

      So, putting this into context within, I have a DRL such as:

      package my.package.example;

      global some.classpath.package.SomeType global_instance;

      rule "Example rule" 
      when 
         some.classpath.package2.MyType ( global_instance.invoke(this) == true ) 
      then 
         // do something 
      end 
      
      

      I am getting an error from the package builder originating from the "Example rule" specifying something like:
      "can't find method MyType.global_instance()"

      Once, again this did work in 5.5.0.Final, but in 5.6.0.Final I am getting a failure trying to build the knowledge package.
      It looks to me like the global_instance symbol is not being recognized as a global in the DRL and is trying to be
      resolved as a method of the MyType class.
      So I guess it would be trying to do a "MyType.global_instance().invoke(this)" or something.

      The intent is that global_instance will be set for a session with an immutable function-type of class
      (invoke is an instance method though; not static). The rule restriction uses this function/predicate to determine if some
      complex criteria is true for `this` MyType instance.

      I would appreciate any insight into what the issue might be. I haven't been able to find any threads out there on a similar issue.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mike.rodriguez_jira Mike Rodriguez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: