Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Infinite advice call problem

Robert,

Let me address a few of your questions:

> >     after(MemoryFault mf):
> >             target(mf) &&
> >             execution(MemoryFault.new(..)) &&
> >             ! cflowbelow(call(Object MemoryFault.clone())
> >                          && within(Constructor)) {
> >        MemoryFault other = (MemoryFault) mf.clone();
> >     }
> 
> How does this ! cflowbelow work, why do you group the "call"
> and "within" under cflowbelow? Is that a control flow where
> a call to clone was made within the Constructor aspect?

Exactly.  It filters out all join points below:

    any join point which is both a call to
    MemoryFault.clone(), and is made from within
    Constructor's definition.

> Does this depend on whether I write call first or within
> first, i.e. is the above equal to
> 
>     ! cflowbelow(within(Constructor) 
>                  && call(Object MemoryFault.clone()))

Yep, they are equivalent. 

> Can this also be written as
> 
> 	!cflowbelow(call(Object MemoryFault.clone())) &&
> 	!cflowbelow(within(Constructor))

This is _more_ restrictive.  This filters out both:

    all join points below any call to MemoryFault's clone
    method, regardless where it comes from, and

    all join points below _any_ join point from within
    Constructor's definition.

> (I remember some warning that the !, && and || are not
> really boolean operators / logic)?

It's not particularly a problem with !, &&, and || here, but
rather with the very powerful cflow constructs.  You should
be pretty safe thinking of !, &&, and || as exactly what
they sound like:  boolean operators on binary predicates.

-erik

-----Original Message-----
From: Robert Wenner [mailto:robert@xxxxxxxxxx] 
Sent: Wednesday, 8 January, 2003 3:15 am
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Infinite advice call problem


Hi Erik!

On Tuesday 07 January 2003 18:09, hilsdale@xxxxxxxx wrote:
> but this won't work either.  You're working with constructor
> _executions_, which occur within the constructor (think of
> them being "callee-side").

Thanks, I guess I have been looking at my code too long to
see this.

> 1. Change to constructor call join points, and filter out
>    the offending calling points with within. 

This is what I wanted. 

> 2. Use cflow to stomp on even indirect recursion
>
>     after(MemoryFault mf):
>             target(mf) &&
>             execution(MemoryFault.new(..)) &&
>             ! cflowbelow(call(Object MemoryFault.clone())
>                          && within(Constructor)) {
>        MemoryFault other = (MemoryFault) mf.clone();
>     }

How does this ! cflowbelow work, why do you group the "call"
and "within" under cflowbelow? Is that a control flow where
a call to clone was made within the Constructor aspect?
Does this depend on whether I write call first or within
first, i.e. is the above equal to

    ! cflowbelow(within(Constructor) 
                 && call(Object MemoryFault.clone()))

Can this also be written as

	!cflowbelow(call(Object MemoryFault.clone())) &&
	!cflowbelow(within(Constructor))

(I remember some warning that the !, && and || are not
really boolean operators / logic)?

>     Note that I've stomped on the indirect recursion rather
>     specifically, picking out exactly one call in the world.
>     In the future, if you use AspectJ 1.1, you might use the
>     new adviceexecution pointcut to pick out all advice
>     executions from the Constructor aspect (This doesn't
>     work in 1.1b2 because of a bug that's being fixed):

Ah, nice idea.

> Let me know if this doens't answer your question,

Yes, it does; thanks a lot.

Robert


Back to the top