[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] aspectOf() and LTW
- From: "Tyler DeWitt" <tyler.dewitt@xxxxxxxxxxxx>
- Date: Mon, 21 Jul 2008 08:30:23 -0600
- Delivered-to: email@example.com
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:sender:to:subject:in-reply-to :mime-version:content-type:references:x-google-sender-auth; b=cw88X5PI4XaYKAZrD8QcLBWebvIL42mljRrEDLzon+5pelzlVyYcrglLhpSNoJPDBP 11rkpZ+Sk40zj+03sjijax805OBZM37mYV4Bvs62v5bnrbZnwp9AF0nQXlzKCqOjWDrJ P2K9fC8QxNZtXBjwNIw9P55wTIszqE2Xi5Cvk=
Is the problem that you are trying to profile java.lang? I thought aspectJ could not ltw on packages in java.*. Is that correct?
On Mon, Jul 21, 2008 at 12:51 AM, Christopher Mason <cmason@xxxxxxxxxx
Are there still problems with @Aspect, Aspects.aspectOf() and load time
weaving? I'm getting NoSuchMethodException, as others have reported in
the past. From which class loader should I obtain the class object that
I pass to aspectOf()? This must be a "woven" aspect class, correct?
How can I easily obtain this?
Confession: what I'm trying to do is a bit complex. I'm using aspectj
to write a java.lang.instrument profiler. So, I've written my own
agent, and I'm calling into Aj from my own implementation of
ClassFileTransformer.transform(). Now, I'm trying to initialize my
aspects with some common dependencies, obtaining the singleton aspect
instances using Aspects.aspectOf(). I suspect what's going on is that
my classloader has the old, un-"woven" aspect class, which lacks the
generated aspectOf() method. I'm trying to do this generally, so I
don't want to just hard code the aspect class name.
When the aspect is precompiled, everything works fine; but when I use
@Aspect I get the NSME.
Perhaps a better question is: is there a way I can obtain all the
instantiated aspects that aspectj knows about? Or some sort of
callback/event mechanism when aspects are actually instantiated? This
would be very useful for injecting dependencies into aspects. How do
others do this?
Any help or pointers would be most appreciated.
aspectj-users mailing list