Skip to main content

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

Would this not be a useful approach? 
 
It would save the runtime check and allow the advice to be applied with the least weaving / code bloat, and therefore would help performance.
 
I suspect it may be a special case, and that what you're doing at the moment allows the rest of the pointcut to be quite general.  e.g. && ((target(X) || target(Y))  would require code inserting in multiple places.  I still suspect it's better than grabbing every call() in the case where the target joinpoint is within a lib we don't want to weave.
 
It's also worth considering how this applies in the world of Equinox Aspects.  Doing the least weaving and having flexibility as to where that weaving happens could be quite important.

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: 25 March 2009 17:54
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] pointcut for super.*(..)

We don't insert any methods like that.  It will advise the setVisible method in the superclass with a runtime check to see what 'this' is at the time setVisible is running - if it is a MyForm then the advice will run.

Andy.

2009/3/25 Neale Upstone <neale.upstone@xxxxxxxxxx>
This reminds me of a question I meant to ask.

If I create around() advice for a method that is not implemented in the
target class, and the implementation does exist in the super class, what
happens.

I know that call(public void setVisible(boolean)) && target(MyForm) will
weave at the call sites, but... what does the weaver do with:
       execution(public void setVisible(boolean)) && this(MyForm)  ?

I'd hope that it ends up with a method added to MyForm, where proceed()
calls super.setVisible().

Is that the case?




> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Simone Gianni
> Sent: 25 March 2009 16:32
> To: aspectj-users@xxxxxxxxxxx
> Subject: 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/
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
**********************************************************************
IMPORTANT NOTICE.
Confidentiality:  This e-mail and its attachments are intended for the above named only and may be confidential.  If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.
Security Warning:  Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium.
We advise that you understand and observe this lack of security when e-mailing us.
Viruses:  Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.
Monitoring and Scanning:  Cambridge Cognition has monitoring and scanning systems in place in relation to emails sent and received to: monitor / record business communications; prevent and detect crime; investigate the use of the Company's internal and external email system; and provide evidence of compliance with business practices.

Cambridge Cognition Limited
Company Registration Number 4338746
Registered address:
Tunbridge Court
Tunbridge Lane
Bottisham
Cambridge
CB25 9TU
UK
**********************************************************************

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

**********************************************************************
IMPORTANT NOTICE.
Confidentiality:  This e-mail and its attachments are intended for the above named only and may be confidential.  If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.
Security Warning:  Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium.
We advise that you understand and observe this lack of security when e-mailing us.
Viruses:  Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.
Monitoring and Scanning:  Cambridge Cognition has monitoring and scanning systems in place in relation to emails sent and received to: monitor / record business communications; prevent and detect crime; investigate the use of the Company's internal and external email system; and provide evidence of compliance with business practices.

Cambridge Cognition Limited
Company Registration Number 4338746
Registered address:
Tunbridge Court
Tunbridge Lane
Bottisham
Cambridge
CB25 9TU
UK
**********************************************************************





Back to the top