AspectJ -- please help

Hi all,

I've got a few problems making the AspectJ support really work. I'm using the current 7.0.4 EAP version of IDEA but this problem was already there with the 7.0.3 release.
I'm using the @AspectJ style notation for aspects (I don't even know if there is support for the aspectj-language style notation).

1) IDEA doesn't know the "call" pointcut type. It says "cannot resolve pointcut 'call'" and ") expected" right after the "call" keyword. But this seems to work fine when compiling stuff, there's no compiler error generated by that.

2) Even if I use something like "execution" as pointcut type and get very specific and IDEA can even navigate to the method I've used in the pointcut -- when I compile the aspect won't get weaved into my code. Shouldn't IDEA take care of that? Or am I supposed to run the ajc by hand or via some build script every time I've made a change related to some Aspect?

3) IDEA doesn't show me the advised methods ("This advice advises no methods.") even if I know it does. This probably has some similar reason as 2).

Is someone successfully using the AspectJ stuff? Can someone help me?

Thanks for your help,
Denis

3 comments
Comment actions Permalink

Currently AOP support in IntelliJ IDEA is targeted for Spring framework,
which has only a limited subset of pointcut expressions ('call', for
example, isn't supported). And besides, IDEA provides editing,
navigation and refactoring support for this @AspectJ subset, and no
compiler integration (since Spring framework takes care of this itself).
For non-Spring projects, we decided to turn on the support for users to
get at least some features. This covers 1) and 2).

3) IDEA doesn't show me the advised methods ("This advice advises no
methods.") even if I know it does. This probably has some similar
reason as 2).

Sorry, I didn't understand you. Could you describe the problem in more
details?

0
Comment actions Permalink

Currently AOP support in IntelliJ IDEA is targeted for Spring framework,
which has only a limited subset of pointcut expressions ('call', for
example, isn't supported). And besides, IDEA provides editing,
navigation and refactoring support for this @AspectJ subset, and no
compiler integration (since Spring framework takes care of this itself).
For non-Spring projects, we decided to turn on the support for users to
get at least some features. This covers 1) and 2).


Thanks, that's helpful. So I'll have to revisit the Spring docs about that and see how to get it to work.
Basically all I did is advise some non-Spring-beans and then tried to just run a testcase and see if the advice works -- but probably Spring requires that all advised beans be created by Spring... But I'll get this one sorted out now that you've pointed me in the right direction.

3) IDEA doesn't show me the advised methods ("This advice advises no
methods.") even if I know it does. This probably has some similar
reason as 2).

Sorry, I didn't understand you. Could you describe the problem in more
details?


Well, I have a pointcut and an advice to be applied at that pointcut. I can navigate to the advised method in IDEA via Ctrl + Click. The Aspect shows no errors. Yet, on the lefthand side, right next to the advice method, if I click on the "advice" icon, IDEA says "This advice advises no methods."
I've attached the screenshot.



Attachment(s):
idea-advice.gif
0
Comment actions Permalink

Well, I have a pointcut and an advice to be applied at that pointcut.
I can navigate to the advised method in IDEA via Ctrl + Click. The
Aspect shows no errors. Yet, on the lefthand side, right next to the
advice method, if I click on the "advice" icon, IDEA says "This
advice advises no methods." I've attached the screenshot.


Still need more details, a simple example resembling yours works for me.
What's your pointcut? Does it reference concrete method? Does it specify
annotations? Is it of "execution(Foo Bar.goo())" type? Does the advised
method take parameters? Are aspect and advised class located in the same
module?

0

Please sign in to leave a comment.