Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] pointcut clash (?)

Hi Luca,

I'm having a little trouble understanding the configuration - those pointcuts are quite complex.

> Now what should happen is that a method of QueryElements is adviced by the
> lazy loader required pointcut, and eclipse confirms this. However, what happen
> observing the running code is that the lazyLoaderRequired pointcut is always
> triggered. I suspect this is due to the fact that two pointcuts are

And this says eclipse confirms a method of QueryElements is advised by the lazy loader
required pointcut and at runtime the lazy loader required pointcut is always triggered.  Did
you mean lazyLoaderForced for one of those?

I'm not sure how you are expecting these two pointcuts to interact at a join point - and how
do you think the second one is overriding the first one? They have different names.  You
can't influence what the first one is doing by writing the second one - unless it was around
advice and the second one happened to have higher precedence and did not proceed to the join
point to drive the lower precedence one.

If you can give a sample of the advised code (or pseudocode for it) and what you want to
achieve, that might help.

The use of cflow is going to cause quite a few markers in AJDT to show up - but they will
all be annotated with a ? indicating the location is advised in the bytecode but a decision will
be made at runtime whether to invoke the advice.

Andy.

2009/3/13 Luca Ferrari <fluca1978@xxxxxxxxxxx>
Hi,
I'm getting into troubles with an aspect that should drive a lazy loader for
complex data types:

 pointcut lazyLoaderRequired( LazyLoading loadingProperties, FilteredLoader
mySelf ) :
                                   (
                                     get( @LazyLoading
Collection<StatefullDatabaseObject+>+ StatefullDatabaseObject+.* )
                                     ||
                                     get( @LazyLoading Map<SerializableObject+,
DatabaseObject+>+ SerializableObject+.* )
                                     ||
                                     get( @LazyLoading Map<SerializableObject+,
StatelessDatabaseObject+>+ SerializableObject+.* )
                                   )
                                   &&
                                   @annotation( loadingProperties )
                                   &&
                                   this( mySelf )
                                   &&
                                   (! execution( public void
FilteredLoader.loadFilteredData(Class) ) )
                                   &&
                                   (! cflow(adviceexecution()) )
                                   ;


the above pointcut intercepts get calls and evaluates if the lazy loading
should happen (or not, if it has been already performed):

before( LazyLoading loadingProperties, FilteredLoader mySelf) :
lazyLoaderRequired( loadingProperties, mySelf)  {
       // perform standard lazy loading
       this.performLazyLoading(loadingProperties, mySelf, false);

   }


Now I've got situations where I want lazy loading to be disabled, so I wrote
another pointcut that partially override the above one:

 pointcut lazyLoaderForced( LazyLoading loadingProperties, FilteredLoader
mySelf) :
                               cflow( lazyLoaderRequired( loadingProperties, mySelf) )
                               &&
                               (
                               execution( public boolean DatabaseDialog+.perform*() throws
DatabaseException )
                               ||
                               withincode( public JComboBox QueryElements.*(..) )
                               ||
                               execution( * DatabaseDialog+.*(..) )


                               )
                               ;

and defined another advice that should be triggered by the above pointcut:

before( LazyLoading loadingProperties, FilteredLoader mySelf ):
lazyLoaderForced( loadingProperties, mySelf)  {
       // perform forced lazy loading
       this.performLazyLoading(loadingProperties, mySelf, true);
   }


Now what should happen is that a method of QueryElements is adviced by the
lazy loader required pointcut, and eclipse confirms this. However, what happen
observing the running code is that the lazyLoaderRequired pointcut is always
triggered. I suspect this is due to the fact that two pointcuts are
overlapping, but I've tried also to isolate the statements of a lazy loading
required but the program always executes the required pointcut/advice.

Any idea about the problem?

Thanks,
Luca
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top