[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Fwd: static context/pointcuts (was [aspectj-users] Object Graph using aspectj)

Hi all,

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.

Thanks,

-- Éric


Begin forwarded message:

From: Eric Tanter <etanter@xxxxxxxxxxxxx>
Date: December 12, 2008 3:07:30  GMT-03:00
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Object Graph using aspectj
Reply-To: aspectj-users@xxxxxxxxxxx

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.

Just wondering:

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 definitions.

(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 for ;)).

-- Éric_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users