Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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.

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

Back to the top