Hi Andy,

 Sorry I didn't answer your private email to me yet, my inbox is a mess
> - but this kind of question is always better on the mailing list (as
> more than just me might answer).
>

   Great! thanks!

Is this not sufficient for you?
>
> after() returning(Foo f): call(Foo.new(..)) {
>  System.out.println("Created a foo "+f);
> }
>

 Yes, great! The main issue is that we do not need the target designator. I
didn't figure out to just use the bound variable from returning. Now it
works! :-)

You live and learn!


Kind Regards,
Henrique

On Fri, Mar 26, 2010 at 9:01 PM, Andy Clement <[email protected]>wrote:

> Hello Henrique,
>
> Sorry I didn't answer your private email to me yet, my inbox is a mess
> - but this kind of question is always better on the mailing list (as
> more than just me might answer).
>
> Is this not sufficient for you?
>
> after() returning(Foo f): call(Foo.new(..)) {
>  System.out.println("Created a foo "+f);
> }
>
> Andy
>
> 2010/3/26 Henrique Rebêlo <[email protected]>:
> > Hi all,
> >
> >  I was wondering whether we can expose the target object of a call
> pointcut.
> >
> >  Consider the following simple class:
> >
> > class C {
> >
> >    public C () {}
> >    ...
> > }
> >
> > along with the simple call pointcut and an after returning advice that
> uses
> > such a pointcut:
> >
> > pointcut callConst(C c) : call (public C.new()) && target(c);
> >
> > after (C c) returning() : callConst(c){
> >
> >     //advice code
> > }
> >
> > The call pointcut callConst() will match any call to C's constructor but
> > only when it does not include the target designator. Without the target
> > designator we cannot expose the target object.
> >
> > So, in the above example, the call is not matched! If we change the call
> to
> > execution pointcut it matches normally (with context exposure )!
> >
> > I want to know the main problem to have accessible the target object in a
> > call pointcut that is used in a after returning advice. As I said, we can
> > expose the object If we use a  after returning advice with execution
> > pointcut. But, according to the AspectJ semantics, after returning call
> will
> > occurs just after the method finishes its execution, so I ask again, Why
> we
> > cannot use context exposure during a call? (at this time the, the
> > constructor already instantiated the object!!). Is there a reason for
> that?
> > or just a language limitation...
> >
> > I just want to have interesting discussions about the AspectJ semantics!
> >
> > cheers,
> > Henrique
> >
> > --
> >
> ...............................................................................................................................
> > Henrique Rebelo
> > http://www.cin.ufpe.br/~hemr <http://www.cin.ufpe.br/%7Ehemr>
> > Informatics Center, UFPE, Brazil
> >
> > _______________________________________________
> > aspectj-users mailing list
> > [email protected]
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



-- 
...............................................................................................................................
Henrique Rebelo
http://www.cin.ufpe.br/~hemr
Informatics Center, UFPE, Brazil
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to