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

Non-deterministic class resolution

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • build, executable model
    • None
    • NEW
    • NEW
    • ---
    • ---

      I observed that on consecutive builds and runs, with no changes between them, one of my queries was returning different results. One result was correct and expected, the other result was not. The behavior was sticky on the build and run, so that if I observe one type of result, I'll always get that type of result until we shut down the application and rebuilt.

      On further inspection I saw that on the unexpected results, the class used in the query was resolving to a different class with the same name, although I'm importing the class I want to query, and I'm not importing the other one.

      For a simplified view, my project is set up so that there is a "models" and "rules" module. The "models" module has an "Apple" class defined. The "rules" module, where my query is defined as well, is where the other "Apple" class is defined.  In my query DRL file, I import my models.Apple class and query it like so:

      import models.Apple;
      
      query GetApple
        $a: Apple()
      end 

       

      If I start up the application and observe the resolution of the Apple class in the query, I see in the generated query in the jar that it's resolving to models.Apple. This is expected.

      If I stop the application and rebuild and restart it, I see it's resolving to rules.Apple. This is unexpected.

      I am observing the issue using the executable model.

       

      Fully qualifying the class in the query seems to have fixed the issue. But I expected that importing the class would resolve the class correctly.

            rhn-support-tkobayas Toshiya Kobayashi
            asimr Asim R
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: