Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspects weave package discrimination

OK If you are using Eclipse and your weaves aren't applying correctly, try refreshing your navigator view... It looks like some build properties are cached based on the files in the navigator view. If these files move or change, you need to F5 your project before the build configuration will change.

Good luck!

--- On Tue, 6/17/08, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
From: Andy Clement <andrew.clement@xxxxxxxxx>
Subject: Re: [aspectj-users] aspects weave package discrimination
To: aspectj-users@xxxxxxxxxxx
Date: Tuesday, June 17, 2008, 12:04 PM

Hello
 Craig,

Your pointcut looks ok... How are you determining whether the advice
is applying? By running the code, or looking at the gutter markers? or
the showWeaveInfo messages output?

To investigate further, you could:

Try simplifying the pointcut 'execution(void main(..))'
Try naming specific packages, does it match the classes then?
Try using the wildcarded package name syntax 'execution(void
*..*.main(..))'

or, if you want to, you can email me the project and i'll work it out.
I've just created a simple variation of your system with a type Foo
in com.acme.package1, com.acme.package2 and com.acme.package2.package3
and they all match:

ajc -sourceroots . -outjar foo.jar -showWeaveInfo
Join point 'method-execution(void
com.acme.package1.Foo.main(java.lang.String[])
)' in Type 'com.acme.package1.Foo' (Foo.java:3) advised by before
advice from 'c
om.acme.PerformanceMonitor' (PerformanceMonitor.java:4)

Join point 'method-execution(void
com.acme.package2.Foo.main(java.lang.String[])
)' in Type 'com.acme.package2.Foo' (Foo.java:3) advised by before
advice from 'c
om.acme.PerformanceMonitor' (PerformanceMonitor.java:4)

Join point 'method-execution(void
com.acme.package2.package3.Foo.main(java.lang.
String[]))' in Type 'com.acme.package2.package3.Foo' (Foo.java:3)
advised by bef
ore advice from 'com.acme.PerformanceMonitor'
(PerformanceMonitor.java:4)

hmmm, you haven't got any compile errors in your code have you?

Andy.

2008/6/17 Craig W Conway <craigwconway@xxxxxxxxx>:
> Why do some of my classes get advice and some don't? (package
dependent)
>
> package com.acme;
> public aspect PerformanceMonitor {
> before() : execution(void *.main(..))
> {
> System.out.println("OK aspect before");
> }
> }
>
> This is getting applied to classes in com.acme.package1 but not to classes
> in com.acme.package2... Why? (Actually only 2 of 13 packages under
com.acme
> get woven event tho all have classes that match the pointcut!)
>
> I'm using Eclipse to build on windows, with no non-default settings on
java
> build or aspect weaving. Using java 5.
>
> To confirm weirdness, I right-click created new classes with
auto-generated
> main methods in several packages. After auto-compiling, some classes got
> advice, some didn't - depending on which package they were created in
(under
> com.acme.whatever).
>
>
> Any tips would be greatly appreciated!
>
> Thanks!
>
> Craig
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top