[rules-users] Incorrect resolution of global symbols in LHS rule constraint (Java dialect)

Davide Sottara dsotty at gmail.com
Wed Jan 29 20:27:20 EST 2014


The bug affects Drools 6.x too, it's probably due to some change in MVEL
and the way it analyzes constraints.
Notably, it works if you write

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

since constraints are expected to evaluate to true anyway.
Can you please open a JIRA ticket anyway?
Thanks
Davide


On 01/29/2014 09:53 PM, mikerod wrote:
> 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 interpeting 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.
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Incorrect-resolution-of-global-symbols-in-LHS-rule-constraint-Java-dialect-tp4027921.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list