[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspectj-dev] Fwd: static context/pointcuts (was [aspectj-users] Object Graph using aspectj)
- From: Eric Tanter <etanter@xxxxxxxxxxxxx>
- Date: Tue, 16 Dec 2008 16:30:47 -0300
- Delivered-to: email@example.com
My post (below) on aspectj-users has not triggered any reaction.
I'm wondering whether on aspectj-dev it would.
Apologies if the question has been asked and answered before -- in
that case, please point me to the appropriate place.
Begin forwarded message:
From: Eric Tanter <etanter@xxxxxxxxxxxxx>
Date: December 12, 2008 3:07:30 GMT-03:00
Subject: Re: [aspectj-users] Object Graph using aspectj
On Dec 12, 2008, at 14:58 , Andy Clement wrote:
If you are using this()/target() to bind context, be aware that
they will not match in a static context (this() wont match when the
join point occurs within a static method for example, and there is
no target() if a call is to a static method). In these cases you
need two sets of pointcuts, one set to handle the static case and
one to handle the non-static case.
Why not following Java's way of dealing with the fact that classes
are not true objects? ie. one uses null for the this object in a
reflective static method invocation -- so this()/target() could
expose null, no?
That would avoid this kind of ad-hoc non-uniformity. It is quite odd
that just by exposing context, one needs to double his pointcut
(of course a nicer alternative would be to really pass the class
object as being the target/this, but that may be too much to ask
aspectj-users mailing list