Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] pointcut for super.*(..)

Hi Andy,
I would see sucha pointcut useful in an expression like (call(* ThatClass.thatMethod(..)) && !supercall()) or (execution(* ThatClass.thatMethod(..)) && !cflow(supercall())) or something similar, cause for many concerns I want to apply something when a particular method is called "from outside" the hierarchy, and not at every possible super invocation which is an implementation POV.

I managed to catch all calls to the "target" bean and not calls to super classes once, using a combination of this, target and an if pointuct saying something like "if(!target.getClass().isAssignableFrom(this.getClass()))", pretty sure it can be done using static join point informations to save a bit of ram. It worked, but was a runtime check, and also a reflective one, so a bit expensive.

My 2 cents.

Simone

Andy Clement wrote:
I'm afraid super calls are not join points. Apply some advice against 'within(B)' and you won't see it recognizing any join point for the super call - so you can't write a pointcut for it.

The reason is partly historical I believe (from days when we were a source pre-processor) - unfortunately addressing it (and looking to introduce them) has never become a high priority issue...

Andy.

2009/3/25 Alejandro Garcia <garciaal@xxxxxxxxxxx <mailto:garciaal@xxxxxxxxxxx>>

    Hello,

    I need to capture a  super method call, any idea how or if it is
    possible?
    Example:

    class A { void a(){} }

    class B extends A {void a(){super.a();}}

Thank you for any help,
    *Alejandro Garcia*
    /Email: garciaal@xxxxxxxxxxx <mailto:garciaal@xxxxxxxxxxx>/
    /Website: http://atelier.inf.unisi.ch/~garciaal
    <http://atelier.inf.unisi.ch/%7Egarciaal>/








    _______________________________________________
    aspectj-users mailing list
    aspectj-users@xxxxxxxxxxx <mailto:aspectj-users@xxxxxxxxxxx>
    https://dev.eclipse.org/mailman/listinfo/aspectj-users


------------------------------------------------------------------------

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


--
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/



Back to the top