[aosd-discuss] excluding a joinpoint shadow

Eric Bodden eric.bodden at mail.mcgill.ca
Mon Feb 26 16:07:23 EST 2007


Hi, Peter.

There is currently no way to do this in AspectJ. People have been
thinking about annotations which one could put on statements or
blocks. This might become a Java Specification Request at some point,
who knows...

But there is another potential solution for your problem, called
tracematches. A tracematch allows you to match on sequences of events
and hence to express things like "only match the n-th method call".

An efficient implementation of tracematches is available in the abc
compiler. You find an introductory paper at:

http://abc.comlab.ox.ac.uk/techreports#abc-2005-1

Hope that helps,
Eric

P.S. Such kinds of questions should rather go to the aspectj-users
list. aosd-discuss is more for general discussion on AOSD.


On 2/26/07, Peter Kim <chpkim at gmail.com> wrote:
> Hi,
>
> What is the best way to go about allowing a particular joinpoint
> shadow (e.g. AST node) to be excluded from being advised?  For
> example, if I have an aspect that advises call(* *.bar()), to exclude
> calls to bar() within operation, I would modify the pointcut to "&&
> !withincode(operation())".  However, I would like to allow the user to
> exclude only the first call to bar() through some comment-annotation
> mechanism as follows:
>
> void operation()
> {
>    foo();
>    bar();
>    //@exclude
>    bar();
> }
>
> I understand that this probably requires some modification to AspectJ
> infastructure, but I'm not very familiar with the infrastructure and I
> would like to know the fastest way to achieve this (though not too
> dirty)...thank you so much!
>
>
> --
> Peter Kim
> Ph.D. Candidate
> Generative Programming Lab
> Department of Electrical and Computer Engineering
> University of Waterloo, Canada
>
> http://swen.uwaterloo.ca/~chpkim
> Tel: +1-519-635-2468
> Office: DC2544
>
> _______________________________________________
> discuss mailing list    -    discuss at aosd.net
>
> To unsubscribe and change options, go to:
> http://aosd.net/mailman/listinfo/discuss_aosd.net
>
> Check out the AOSD.net Wiki: http://aosd.net/wiki
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada



More information about the discuss mailing list