Methods calling foo(), as Krishna mentioned further up, use
thisEnclosingJoinPointStaticPart:

before(): call(* foo(..)) {
System.out.println(thisEnclosingJoinPointStaticPart);
}

Or use declare warning to see them without running the code:

declare warning: call(* foo(..)): "foo() called from
{joinpoint.enclosingmember}";

For declare warning inserts see the readmes:
http://eclipse.org/aspectj/doc/released/README-169.html
http://eclipse.org/aspectj/doc/released/README-174.html

Andy


On 6 January 2014 05:17, samantha joseph <samanthajosep...@gmail.com> wrote:

> Hello...
>
> how to get the methods calling a particular methods i.e.  i want to know
> which methods are calling method xyz()
>
> Thanx.
>
>
> On Tue, Dec 31, 2013 at 1:19 PM, samantha joseph <
> samanthajosep...@gmail.com> wrote:
>
>> one more situation is arising. What if method1 is calling methods from
>> another class. How to trace these calls.
>>
>>
>> On Tue, Dec 31, 2013 at 1:00 PM, Krishna Jasty <krishna.ja...@tcs.com>wrote:
>>
>>> *before*() : *call*(* method1(..)) && *within*(*XYZ*)
>>>
>>> *thisEnclosingJoinPointStaticPart*.toString() may report calling method
>>> information.
>>>
>>> Thanks,
>>> krishna
>>>
>>>
>>>  From: samantha joseph <samanthajosep...@gmail.com> To:
>>> aspectj-users@eclipse.org Date: 12/31/2013 12:48 PM Subject: Re:
>>> [aspectj-users] How to trace method calls generated from a        method 
>>> Sent
>>> by: aspectj-users-boun...@eclipse.org
>>> ------------------------------
>>>
>>>
>>>
>>> Thnx krishna, but the problem actually is that if i dont know what are
>>> the methods called by method1().
>>>
>>> I am trying to do dynamic analysis. So, i dont know the whole code. I
>>> just know that method1() exist in class say XYZ. But i dont want to go
>>> through the code. Is it possile??
>>>
>>>
>>> On Tue, Dec 31, 2013 at 12:28 PM, Krishna Jasty 
>>> <*krishna.ja...@tcs.com*<krishna.ja...@tcs.com>>
>>> wrote:
>>> *call*(* **(..)) will enable for all methods.
>>>
>>> if you want method2 and method3 then as follows
>>>
>>> * call*(* method1(..)) ||*call*(* method1(..))
>>>
>>> Thanks,
>>>
>>>
>>>   From: Swati <*samanthajosep...@gmail.com* <samanthajosep...@gmail.com>
>>> >  To: *aspectj-users@eclipse.org* <aspectj-users@eclipse.org>  Date: 
>>> > 12/31/2013
>>> 12:10 PM  Subject: [aspectj-users] How to trace method calls generated
>>> from a method  Sent by: 
>>> *aspectj-users-boun...@eclipse.org*<aspectj-users-boun...@eclipse.org>
>>>
>>>  ------------------------------
>>>
>>>
>>>
>>>
>>> I am using AspectJ in eclipse. i am not able to find out how to get
>>> methods
>>> called by a method using aspectj.
>>>
>>> For ex..
>>>
>>> void method1()
>>> {
>>>
>>> method2();
>>> method3();
>>>
>>> }
>>>
>>> when method1 is called, then i want to get that method2() and method3()
>>> are
>>> called by method1().
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> *http://aspectj.2085585.n4.nabble.com/classes-and-methodes-name-tp4650877p4651236.html*<http://aspectj.2085585.n4.nabble.com/classes-and-methodes-name-tp4650877p4651236.html>
>>> Sent from the AspectJ - users mailing list archive at Nabble.com.
>>> _______________________________________________
>>> aspectj-users mailing list
>>> *aspectj-users@eclipse.org* <aspectj-users@eclipse.org>
>>> *https://dev.eclipse.org/mailman/listinfo/aspectj-users*<https://dev.eclipse.org/mailman/listinfo/aspectj-users>
>>>
>>>  =====-----=====-----=====
>>> Notice: The information contained in this e-mail
>>> message and/or attachments to it may contain
>>> confidential or privileged information. If you are
>>> not the intended recipient, any dissemination, use,
>>> review, distribution, printing or copying of the
>>> information contained in this e-mail message
>>> and/or attachments to it are strictly prohibited. If
>>> you have received this communication in error,
>>> please notify us by reply e-mail or telephone and
>>> immediately and permanently delete the message
>>> and any attachments. Thank you
>>>
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> *aspectj-users@eclipse.org* <aspectj-users@eclipse.org>
>>> *https://dev.eclipse.org/mailman/listinfo/aspectj-users*<https://dev.eclipse.org/mailman/listinfo/aspectj-users>
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@eclipse.org
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>>
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@eclipse.org
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>>
>>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to