miroir de
https://github.com/eclipse-aspectj/aspectj.git
synchronisé 2024-09-03 05:54:57 +02:00
27 lignes
596 B
Java
27 lignes
596 B
Java
import org.aspectj.testing.Tester;
|
|
|
|
public aspect AdviceOnIntroduced {
|
|
public static void main(String[] args) { test(); }
|
|
|
|
public static void test() {
|
|
Tester.checkEqual(new Foo(10).foo(5), 6, "foo");
|
|
}
|
|
|
|
int Foo.foo(int n) { return n; }
|
|
Foo.new(int w) { this(); }
|
|
|
|
int around(int n):
|
|
within(AdviceOnIntroduced) &&
|
|
(args(n) && execution(int foo(int))) {
|
|
int result = proceed(n);
|
|
return result+1;
|
|
}
|
|
|
|
before(): within(Foo) && execution(new(..)) {
|
|
//System.out.println("before new");
|
|
}
|
|
}
|
|
|
|
class Foo {
|
|
}
|