Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » newbie question
newbie question [message #49688] Wed, 09 March 2005 11:02 Go to next message
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 #49718 is a reply to message #49688] Wed, 09 March 2005 12:35 Go to previous messageGo to next message
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 #49746 is a reply to message #49718] Wed, 09 March 2005 15:49 Go to previous messageGo to next message
Eclipse User
Originally posted by: hmcbride.curamsoftware.com

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/
Re: newbie question [message #49806 is a reply to message #49746] Thu, 10 March 2005 17:26 Go to previous message
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 12:35 Go to previous message
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 15:49 Go to previous message
Hugh McBride is currently offline Hugh McBride
Messages: 2
Registered: July 2009
Junior Member
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/
Re: newbie question [message #587398 is a reply to message #49746] Thu, 10 March 2005 17:26 Go to previous message
Adrian Powell is currently offline Adrian Powell
Messages: 16
Registered: July 2009
Junior Member
Hugh McBride wrote:
> Thanks Rafal, What does AFAICT stand for ?

As Far As I Can Tell.

-a.
Previous Topic:Where to begin? java.lang.NoSuchFieldError: ajc$cflowCounter$0
Next Topic:Where to begin? java.lang.NoSuchFieldError: ajc$cflowCounter$0
Goto Forum:
  


Current Time: Thu Oct 23 01:47:28 GMT 2014

Powered by FUDForum. Page generated in 0.02407 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software