2009/10/31 Niclas Hedhman <[email protected]> > On Sat, Oct 31, 2009 at 3:16 PM, Niclas Hedhman <[email protected]> > wrote: > > > If the return type matches, then CGLib will only create a single > > MetodProxy and things works. > > Well, looking further; > > When the Enhancer is created, we have an accept() callback, which in > case of the non-equal method return types will be called twice, and > the signatures differs; > > For the interface method, it will look like; > public volatile java.util.Collection > org.qi4j.runtime.mixin.Qi228Test$SomeLogicMixin.getNumbers() > > and for the implementation method; > public java.util.List > org.qi4j.runtime.mixin.Qi228Test$SomeLogicMixin.getNumbers() >
FYI if you look at the concrete class it will probably have two methods as well - the original method and another generated by the compiler to fudge the return type to match the interface. Using reflection "method.isSynthetic()" will return true for the compiler generated method. When intercepting I usually ignore any synthetics as they're just layers/adapters on top of the real method. Otherwise you end up with double invocations, etc... HTH > But if the correspond, only the latter one is asked for acceptance. > > > Cheers > -- > Niclas Hedhman, Software Developer > http://www.qi4j.org - New Energy for Java > > I live here; http://tinyurl.com/2qq9er > I work here; http://tinyurl.com/2ymelc > I relax here; http://tinyurl.com/2cgsug > > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > -- Cheers, Stuart
_______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

