I am attempting to set a global to the value of a looked-up session bean.

The global is defined as being of the business interface type.

When I look up this EJB, and attempt to set the global, AbstractWorkingMemory barfs at line 615 (5.2.0 HEAD) saying that my EJB reference is not in fact an instance of the proper type.  This is because of course the EJB reference is a dynamic proxy class generated by the EJB container.  So the stack looks like this:

Expected [com.foobar.Responses], found [$Proxy143].
    at org.drools.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:615)
    at org.drools.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:319)

The comparison is being done by AbstractWorkingMemory by taking (in my case) Responses.class (an interface--the correct interface) and doing this:

Responses.class.isInstance(theProxyISupplied);

This returns false.

Actually, this surprised me: the Java notes on dynamic proxy classes indicate that the following statement must return true:

  theProxyISupplied instanceof Responses;

...but they say nothing about the Class#isInstance(Object) method.

Is there an additional edge case comparison here that needs to happen?

Thanks,
Laird