Re: [abc-users] How to find places where each piece of advice is woven

From: Meisam Fathi <meisam.fathi_at_gmail.com>
Date: Sat, 10 Jan 2009 15:39:03 +0330

Hi Eric,
thanks for your comment. Although I didn't find
"abc.tm.weaving.weaver.tmanalysis.query.WeavableMethods", I solved my
problem as follow:

========================================================================================v
GlobalAspectInfo globalAspectInfo =
Main.v().getAbcExtension().getGlobalAspectInfo();
MethodAdviceList adviceList =
globalAspectInfo.getAdviceList(sootMethod).allAdvice();
========================================================================================^

and I got the list of soothMethods as follow:

========================================================================================v
Set<AbcClass> abcClasses = globalAspectInfo.getWeavableClasses();
for (final AbcClass abcClass : abcClasses) {
    List<SootMethod> methods = abcClass.getSootClass().getMethods();
    // code for finding the list of all advice for each methods
}
========================================================================================^

Anaway, I have some other questions, which I will ask under new topics.

Good Luck.
Meisam

Eric Bodden wrote:
> Hi Meisam.
>
> I used the following procedure when using abc:
>
> First I use the class WeavableMethods to iterate through all methods
> that may be woven into:
>
> http://musketeer.comlab.ox.ac.uk/javadoc/abc-dev/abc/tm/weaving/weaver/tmanalysis/query/WeavableMethods.html#getAll()
>
> Then for each such method I call getAdviceList(..):
>
> http://musketeer.comlab.ox.ac.uk/javadoc/abc-dev/abc/weaving/aspectinfo/GlobalAspectInfo.html#getAdviceList(SootMethod)
>
> This method returns a MethodAdviceList. Call allAdvice() to retrieve a
> list of all AbstractAdviceApplications (if I am not mistaken) that
> apply in the given method.
>
> Hope that helps.
>
> Eric
>
> 2009/1/10 Meisam Fathi <meisam.fathi_at_gmail.com>:
>> Hi there,
>> I am a new abc user. I'm working on testing and debugging AspectJ
>> programs, and I want to use abc for analyzing source code. What I want
>> to do is finding places where advice bodies are woven, i.e. for each
>> advice, I want to obtain a list of all places where this advice is
>> woven. Obviously, abc computes such a list when it compiles AspectJ
>> code, but how can I obtain it. Is what I want available in
>> GlobalAspectInfo class, or somewhere esle, or should I develop some
>> extra piece of code to obtain it? If some extra code is needed, should I
>> add some classes to abc, or should I change some of the existing classes?
>>
>> Tanks in advance.
>> Meisam
>>
>>
>
>
>
>
Received on Sat Jan 10 2009 - 12:10:11 GMT

This archive was generated by hypermail 2.2.0 : Sat Jan 10 2009 - 13:50:11 GMT