Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] [Xlint:adviceDidNotMatch]

Andy,
 
My setup is like this:
  • I'm using IntelliJ to develop a web application, servlet based.
  • The .aj file I use is only applied when I change the compiler to ajc as opposed to javac.
  • So I'm using this in my development environment and using ajc only when I want to debug something, injecting audit information.
  • So what you are doing in your example, weaving SomeAspect.aj into a jar is similar to what I'm doing, just that I'm doing it with the class files and not a jar.
  • I don't use annotations at all, since they don't offer the level of control I want. 

This was working before, but it's possible being a big project with multiple developers that some other jar file in my classpath is messing with aspectj.  I tried to get back to the environment where it last worked, but so far I haven't been able to.  I could probably provide you with a war file that contains some source.  That's a little touchy since the code is proprietary. I think though that I could probably recreate this without sending everything along with it. 

 

Thanks for the response.  I'm open to any ideas to figure this out.

 

Scott

 


 



From: Andy Clement <andrew.clement@xxxxxxxxx>
To: AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>
Sent: Wed, June 22, 2011 6:12:24 PM
Subject: Re: [aspectj-dev] [Xlint:adviceDidNotMatch]

Hi Scott,

Are you binary weaving or building all from source?  It sounds like
you are binary weaving.

Maybe I'm reading too much into it, but you mention that myClass is on
your *classpath* - that isn't sufficient for it to be woven when
compiling your aspect.  classpath is only used to resolve
dependencies.

If you want to weave some bunch of code you built earlier, you should
use inpath:

ajc -inpath myPreviouslyBuiltCode.jar SomeAspect.aj -outjar
wovenVersionOfThatCode.jar

But if it is that, it doesn't explain why you get different behaviour
dependent on version... If there is a regression here I'd like to get
it resolved, rather than force you back to an old level.  The only
known regression I'm aware of at the moment relates to a particular
kind of annotation matching, and you don't appear to be using
annotations in your pointcut.

cheers
Andy

On 22 June 2011 14:35, Scott <jackett_dad@xxxxxxxxx> wrote:
> I'm working on an aspect that used to work, but I've since changed versions
> of java from 1.5 to 1.6.
>
> Java version is 1.6.0_25, and for AspectJ is the latest as of today(
> 1.6.12.M1 ).  I had successfully used AspectJ version 1.6.11.  When I was
> trying to get this all working in the first place, I was using 1.6.10, and
> was having the same issue as I'm seeing now.
>
> I'm getting the warning in the subject line that my advice does not match.
> I can't get any advice working that refers to my code. If I do this:
>
> public aspect proAuditAspect
> {
>     pointcut traced() : ! within( proAuditAspect );
>
>     before() : traced()
>     {
>     }
> }
>
> ...I get no warning. But if I do this:
>
> import com.myCompany.myClass;
>
> public aspect proAuditAspect
> {
>     pointcut traced() : execution( * myClass.execute() ) &&
>         ! within( proAuditAspect );
>     before() : traced()
>     {
>     }
> }
>
> (the difference is only the bolded part)
>
> The class exists in my classpath, but I get the warning and the advice is
> never called.
>
> I'm not sure what anyone on the list can do without my environment, but is
> there anything I'm missing?  Should I try going back a few versions of
> AspectJ?  I've tried dropping back to Java 1.5, but same problem.
>
> I use the ajc compiler to compile my java classes. and set the target to
> 1.5.
>
> Thanks for any advice (no pun intended) you can give.
>
> Scott
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Back to the top