| newbie question [message #49688] | 
Wed, 09 March 2005 06:02   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: hmcbride.curamsoftware.com 
 
Am quite new to aop , currently investigating the use of eclipse and  
aspectj for detecting illegal method calls ( i.e policy enforcement).  
There is a code pattern   
that we are looking to detect , a double for loop that contains certain  
set methods i.e.  
 
 
 for(int i = 0; i< 10; i++) 
 { 
   for(int j = 0; j< 10; j++) 
    { 
 
      classInstanceA.setObscureVar(blah); 
      classInstanceB.setOtherObscureVar(blahblah); 
 
    } 
} 
 
 this to prevent certain variable from being overwritten.   
 
     Is there any way I can detect this type of construct using aop. 
 
Any pointers /suggestions welcome 
 
thanks in advance 
H
 |  
 |  
  | 
 | 
 | 
| Re: newbie question [message #49806 is a reply to message #49746] | 
Thu, 10 March 2005 12:26   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: adrian.redpointsoft.com 
 
Hugh McBride wrote: 
> Thanks Rafal, What does AFAICT stand for ?    
 
As Far As I Can Tell. 
 
-a.
 |  
 |  
  | 
| Re: newbie question [message #587353 is a reply to message #49688] | 
Wed, 09 March 2005 07:35   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: Rafal.Krzewski.caltha.pl 
 
Hugh McBride wrote: 
> There is a code pattern  that we are looking to detect , a double for  
> loop that contains certain set methods i.e. 
>  
> for(int i = 0; i< 10; i++) 
> { 
>   for(int j = 0; j< 10; j++) 
>    { 
>  
>      classInstanceA.setObscureVar(blah); 
>      classInstanceB.setOtherObscureVar(blahblah); 
>  
>    } 
> } 
>  
> this to prevent certain variable from being overwritten.  
>     Is there any way I can detect this type of construct using aop. 
 
It is a valid use case for AOP, but AFAICT it is impossible to do this  
using AspectJ. 
 
The problem is the implemented join point model. In AOP there are many  
kinds of join points, including for loop body execution. Actual AOP  
implementations, like AspectJ support only a subset of the possible join  
points that can be matched by pointcuts in your aspects. The joinpoints  
that are left out are those that cannot be reliably described: If you  
have several loops in a single method, how do you describe in the  
pointcut which loop do you mean? 
 
At this point AspectJ does not provide a pointcut for picking out code  
blocks (like loop or conditional bodies), so you won't be able to detect  
that anti-pattern with AspectJ. 
 
regards, 
Rafal
 |  
 |  
  | 
| Re: newbie question [message #587361 is a reply to message #49718] | 
Wed, 09 March 2005 10:49   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
RafaÅ Krzewski wrote: 
 
> Hugh McBride wrote: 
>> There is a code pattern  that we are looking to detect , a double for  
>> loop that contains certain set methods i.e. 
>>  
>> for(int i = 0; i< 10; i++) 
>> { 
>>   for(int j = 0; j< 10; j++) 
>>    { 
>>  
>>      classInstanceA.setObscureVar(blah); 
>>      classInstanceB.setOtherObscureVar(blahblah); 
>>  
>>    } 
>> } 
>>  
>> this to prevent certain variable from being overwritten.  
>>     Is there any way I can detect this type of construct using aop. 
 
> It is a valid use case for AOP, but AFAICT it is impossible to do this  
> using AspectJ. 
 
> The problem is the implemented join point model. In AOP there are many  
> kinds of join points, including for loop body execution. Actual AOP  
> implementations, like AspectJ support only a subset of the possible join  
> points that can be matched by pointcuts in your aspects. The joinpoints  
> that are left out are those that cannot be reliably described: If you  
> have several loops in a single method, how do you describe in the  
> pointcut which loop do you mean? 
 
> At this point AspectJ does not provide a pointcut for picking out code  
> blocks (like loop or conditional bodies), so you won't be able to detect  
> that anti-pattern with AspectJ. 
 
> regards, 
> Rafal 
 
 
Thanks Rafal, What does AFAICT stand for ?   
   
 Bruno Harbulot seems to be doing some work wrt loop detection and aspects 
 see his page at  
 
 http://www.cs.man.ac.uk/cnc/students/harbulob/
 |  
 |  
  | 
 | 
Powered by 
FUDForum. Page generated in 0.06196 seconds