Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] call and execution pointcut problem

Hi Mikael.

This is not a bug but to be expected. Please note that while
'execution()' is woven into the target method (callee), 'call()' is
woven into the calling method (caller). However, the caller is your
test, and probably you configured AspectJ Maven to use the 'compile'
goal, but not the 'test-compile' goal. Or maybe your plugin
configuration conflicts with Maven Compiler, which can happen if you are
not using the default phase but a custom one, leading to Maven Compiler
to recompile and overwrite code which previously was compiled by AspectJ
Maven already. Without an MCVE [1] this is difficult to say.

[1] https://stackoverflow.com/help/mcve

-- 
Alexander Kriegisch
https://scrum-master.de


Mikael Petterson:

> I have the following maven modules:
> 
> 1.Aspects
> 
> 2.Sim
> 
> 3.Test
> 
> Aspect looks like:
> 
> (...)
> @annotation(Deprecated) && (call(public * *(..)) || call(*.new(..)));
> (...)
> 
> I have built Aspect and weaved it into Sim module using the
> 
> <aspectLibraries>
> <aspectLibrary>
> 
> tags.
> 
> I add a @Deprecated method in Sim module on a class method.
> 
> Then I let one of my tests in Test module call the method annotated
> @Deprecated in Sim module.
> 
> When using 'call' in the aspect I don't see the info, println in
> aspect, of my deprecated method in Sim module being called.
> 
> However if I change to 'execution' in my aspect then I can see that
> the info of my method in Sim module being called. All other things the
> same.
> 
> Problem with this is I cannot see the calling class. There is no info
> for that when using 'execution'.
> 
> Is this is a bug? Or am I using it in the wrong way?


Back to the top