Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Weaving classes in rt.jar

On Thu, Oct 23, 2008 at 10:33 AM, Mario Mendez-Lojo
<marioml@xxxxxxxxxxxxxxx> wrote:
>
> Hi guys,
>
> I'm trying to weave the classes in rt.jar. For instance, I would like to log every call to the method HashSet.add(). Tracking calls from client code won't work, since there might be calls to HashSet.add() from within rt.jar.
>
> The constraint is that I cannot weave the JDK source, generate a new rt.jar, and prepend it to the bootclasspath.

As far as I know, prepending the bootclasspath is the only solution to
this problem. You don't necessarily have to use the JDK sources, you
can do binary weaving.

> Therefore, LTW seems to be the solution -- but I understand that AspectJ is a Java app that it has to be loaded *after* rt.jar is loaded (chicken and the egg kind of thing).
>
> I guess that reloading + weaving is the only possibility left -- is it possible to weave classes in rt.jar after they have been loaded ? Can you please point at an example so I can see how that works?

I don't think you can weave classes after they have been loaded - the
weaving happens in the class loader I believe.

> Thank you very much!!!!!!!

~David


Back to the top