[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Exposing context in a Pointcut

Hello there,

I have several questions. Firstly, I would like a pointcut to expose a
reference to the currently-executing object, so that I can call
"wait()" on that object in my advice (think along the lines of
Breakpoints). However, suppose I don't necessarily wish to use this
variable in the pointcut definition (in this(), target(), or args()),
but only in the advice itself. Is there any way of doing this, without
getting a "[error] formal unbound in pointcut
pointcut" error?

Secondly, I would like to have my aspect do something straight away
(unconditionaly) when it runs, so I chose to do this:

static {
  ... blah
}

However, by doing it this way, I don't have access to any context.
Thus, I am forced to create a pointcut that references the joinpoint
where my "public static void main()" runs, in order to get that class.
Am i stuck to doing it this way?

My third question is this: are there / will there ever be Joinpoints
for getting / setting local variables? At the moment, I am limited to
only class fields, which is a bit of a limiting factor when I want to
"Watch" all variables in my program.

Thanks in advance,
Matt Morten