[aspectc-user] construction(...) and whithin(...)

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Mon May 30 13:53:31 CEST 2005


Hi,

Miguel Almeida wrote:
> Hi.
> 
>  
> 
> I’m trying to create an advice activated by a construction within a 
> certain class.
> 
>  
> 
> Class A {
> 
>             ...
> 
> }
> 
>  
> 
> Class B {
> 
>             void foo() {
> 
>                         A _a;
> 
>             }
> 
>             //or
> 
>             A _a_;
> 
> }
> 
>  
> 
> //My advice:
> 
>  
> 
> advice construction(“A”) && within(“B”) {...}
> 
>  
> 
> //I also tried:
> 
>  
> 
> advice construction(“A”) && within(“% B::%(…)”) {...}
> 
>  
> 
> None of this seems to work. Am I doing something wrong?
> 
>  
> 
> Thanks
> 
>  
> 
> Miguel Almeida
> 
>  
> 
> Miguel Vieira de Campos Almeida
> 
> mvieira at fe.ucp.pt <mailto:mvieira at fe.ucp.pt>
> 
> Faculdade de Engenharia
> 
> Universidade Católica Portuguesa

you can imagine "construction" as the "execution of the constructor". 
Therefore, construction("X") is always within("X") and never 
within("SomeOtherClass"). If you want to check if the construction was 
performed by "B" you have to use cflow().

Best regards,

Olaf Spinczyk



More information about the aspectc-user mailing list