Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Get enclosing method signature of a join point


Jennie,

I presume you are using pointcuts other than method execution e.g. field get to track coverage. The WeaveMessage class gives you both the aspect and affected type name as well as the message issued. From this you can determine which line numbers in which source files will be monitored. Therefore you can actually determine the scope in terms of source lines for a method (using the message for constructor-/method-execution) and therefore which join point (shadows) it contains.

There have been a number of enhancements since weaveinfo messages were introduced in Bug 36747 but a quick search of Bugzilla yields nothing similar to what you request. I suggest you open an enhancement describing the additional information you are looking for and/or any extensions to the existing WeaveMessage interface. However, this is quite a narrow use case and the request will be prioritized accordingly ;-).

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM United Kingdom Limited
Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)



jennie <jenniemai81@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

14/03/2007 00:11

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
RE: [aspectj-users] Get enclosing method signature of a join point





Hi Ron,

Ok, I think I see where the confusion is. You are
assuming (and this must be the correct way of doing
it) that I need to access the enclosing method within
my aspect definitions. What I've really been doing is
grabbing weave data by parsing the --showWeaveInfo
messages through a custom MessageHandler. This way, I
have info on all the weaved classes even if they are
never hit.

I am working on a coverage tool, which needs to have a
comprehensive view of each class' methods; it needs to
know beforehand how many matching joinpoints to
pointcuts there are. At runtime, I keep track of
surrounding info about each joinpoint and update the
coverage numbers, based on whether or not they have
been executed. I'm currently able to give class-level
information, but thought it would be helpful to give
method-level coverage information also.

Does this make it clearer? Please let me know if it
doesn't make sense or if I'm completely missing an
easier approach to this.

Your previous answer was helpful to me because I
needed to know how to get enclosing method info on the
runtime side also.

Thanks very much.


--- Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:

> Hi Jennie,
>
> The information in thisEnclosingJoinPointStaticPart
> is available before the
> application is running (e.g., you could even use it
> in a if() pointcut
> designator). Extending the interface of
> thisJoinPoint and static part is
> something that needs to be considered carefully to
> make sure you preserve
> compatibility and have a well-designed feature. So
> I'd sure like to
> understand what you're trying to achieve with this.
> With respect to the
> license, AspectJ is licensed under the Eclipse
> Public License, which is
> fairly permissive so making variations is allowed
> (although it's better to
> keep a standard version) - I'm not a lawyer though.
> And, you're welcome :-).
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf
> Of jennie
> Sent: Tuesday, March 13, 2007 4:27 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] Get enclosing method
> signature of a join point
>
> Hi Ron,
>
> Thanks again for the quick reply. I think I used the
> wrong terminology in the previous post -- I meant to
> ask if this information is available when making the
> Join Point, before the app is running?
>
> Since enclosure is lexical, this information seems
> attainable by the aspectj compiler/weaver. Do you
> think the task of including enclosing method info is
> very difficult? I can take a stab at the aspectJ
> code
> and see if I can modify it , perhaps a modified
> output
> of --showWeaveInfo to include more context. Is this
> allowed under the aspectJ license?
>
>
> --- Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:
>
> > Hi Jennie,
> >
> > You can get the static subset of information about
> > the join point using
> > thisEnclosingJoinPointStaticPart. That can be used
> > to find the signature of
> > the method. This will find join points like the
> > execution that encloses a
> > call join point. However, they won't report on an
> > "enclosing" call join
> > point for execution: the notion of enclosure is
> > lexical, not dynamic.
> >
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On
> Behalf
> > Of jennie
> > Sent: Tuesday, March 13, 2007 3:14 PM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: [aspectj-users] Get enclosing method
> > signature of a join point
> >
> > Hi there,
> >
> > Is there way to get the enclosing method signature
> > of
> > a particular join point? For example, for
> >
> > class A{
> >
> >    public void foo(){
> >        System.out.println("Testing");
> >    }
> > }
> >
> > If there is a join point at the method call
> > "System.out.println()", can I figure out that the
> > enclosing method is foo() during weave time?  
> >
> > Thanks in advance.
> >
> >
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> >
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> >
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
>
>
>
>  
>
____________________________________________________________________________
> ________
> Finding fabulous fares is fun.  
> Let Yahoo! FareChase search your favorite travel
> sites to find flight and
> hotel bargains.
> http://farechase.yahoo.com/promo-generic-14795097
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
>




____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







Back to the top