Description
We are using the iBatis enhanced (cglib) proxy for lazy loading our bean
references. One of these returned-proxied object is accessing a
default-modifier method of another class in the same package. The code compiles
without error but running it throws an IllegalAccessException thrown from the
CGLIB-Proxy as it tries to invoke a non-public (default or protected) method
from a different package.
I wrote a test case for this problem (see attached patch).
There is a solution (at least for default-modifier methods) for this problem
using cglib LazyLoader callbacks. This is a replacement for the invocation handler
which also has the advantage of increasing the performance of proxied objects
as no methods are intercepted. This solution is contained in the attached
patch. Unfortunately cglib handles protected methods differently to default so
this solutions does not work with protected method calls.