Hi,

I am using Drools 4.0.7, and I had a DRL rule similar to the following:

rule "..."
  when
    other : Foo( )
    x : Bar( ) from other.property

  then
    ...
end

An unexpected bug occured. In some situations, other.property would _not_ be of type Bar, yet Drools would still think that it was. As a result I was getting some unusual exceptions being thrown: "org.mvel.CompileException: unable to resolve property: ..."

If I changed the rule to:
    x : Bar( ) from other.property
    eval ( x instanceof Bar )

It would instead throw a ClassCastException (i.e. "Baz cannot be cast into Bar").

If, instead, I changed the rule to:
    x : Bar( other.property == x )

It would start working correctly, and 'x' would only be of type Bar.

Is this known behaviour? Is it expected? If so, I would appreciate it if the 4.0.7 documentation was updated to reflect that "from" actually ignores the return type of properties. It took me a couple of hours to detect and fix this bug.

I would try these rules in Drools 5.x, but I'm still waiting for the blocking JBRULES-2218 to be resolved.

Cheers
Jevon