Re: CGLib help

From: Bill Dudney (bdudne..ac.com)
Date: Tue May 16 2006 - 23:40:48 EDT

  • Next message: Andrus Adamchik: "Re: CGLib help"

    Hey Andrus,

    I spent the bulk of my time investigating ASM route and I don't see a
    straightforward way to do the injection. Creating new methods is
    straightforward but injecting method calls around the original method
    is not so straightforward.

    Any ideas how that might work?

    Thanks,

    -bd-

    On May 16, 2006, at 10:22 AM, Andrus Adamchik wrote:

    > Bill,
    >
    > This confirms my suspicion that CGlib was not designed for such
    > use. Probably we may need to try using ASM directly. But of course
    > if anyone can get in touch with CGlib folks, it would be nice to
    > doublecheck with them.
    >
    > Andrus
    >
    >
    > On May 16, 2006, at 1:50 AM, Bill Dudney wrote:
    >
    >> Hi Andrus,
    >>
    >> Sorry I'm still not done.
    >>
    >> I've been searching and hacking for way to long now to try to get
    >> this code in. The basic problem is that like you I could not find
    >> a way to wrap the original implementation of the method using the
    >> CGLib implementation path that exists in the rest of the code. It
    >> appears to be easy with the Enhancer API.
    >>
    >> I prefer your approach to the Enhancer but I'm at a loss as to how
    >> to make it work. I'll try to get some more time tomorrow to look
    >> at it but I'm going to be very busy doing J1 stuff.
    >>
    >> Does anyone know if the CGLib folks are on IRC anywhere?
    >>
    >> TTFN,
    >>
    >> -bd-
    >>
    >> On May 4, 2006, at 7:15 PM, Andrus Adamchik wrote:
    >>
    >>> I need some help with CGLib. It is great for proxies, but our
    >>> enhancer changes the actual class instead of making a proxied
    >>> subclass. Such scenario is a pain... Maybe Jeff or someone else
    >>> has an idea how to implement the enhancing code below?
    >>>
    >>> Basically I am trying to inject code calling a static delegate
    >>> method in three places:
    >>>
    >>> 1. Property getter start: DataObjectDelegate.beforeGetProperty
    >>> 2. Property setter start: DataObjectDelegate.beforeSetProperty
    >>> 3. Property setter end: DataObjectDelegate.afterSetProperty
    >>>
    >>> I was able to implement a simpler case of creating synthetic
    >>> properties with getters and setters (InterfaceMethodInjector),
    >>> but got stuck with this one (see TODO's on the
    >>> DataObjectAccessorInjector). I suspect we'll have to use ASM for
    >>> that, but if anyone can figure a CGlib solution, please let me know.
    >>>
    >>> Andrus
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue May 16 2006 - 23:44:46 EDT