[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Annotations, inner classes and set && withincode
|
Can't seem to get a pointcut to work on a setter that is within a method
of an inner class.
A pointcut on the outer class works fine (see "doSomething").
Also a pointcut of just the "set" or just the "within" works fine, just
not the && of the two.
Any thoughts?
thx in advance, Haddock
package foo;
public class App
{
private int count;
public static void main( String[] args )
{
try {
App app = new App();
app.doSomething();
} catch (Exception e) {
e.printStackTrace();
}
System.exit(1);
}
public App() {
}
private void doSomething() {
System.out.println("> before");
count = 30;
System.out.println("> after");
new App.Inner().innerDoSomething();
}
private class Inner {
private void innerDoSomething() {
System.out.println(">> before");
count = 25;
System.out.println(">> after");
}
}
}
package aspects;
@Aspect
public class LoggingAspect {
@Pointcut("set(int foo.App.count) && withincode(void
foo.App.doSomething())")
void doSomething() {}
@Before("doSomething()")
public void logDoSomething() {
System.out.println("doSomething()");
}
@Pointcut("set(int foo.App.count) && withincode(void
foo.App.Inner.innerDoSomething())")
void innerDoSomething() {}
@Before("innerDoSomething()")
public void logInnerDoSomething() {
System.out.println("innerDoSomething()");
}
}