spogulis no
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-26 17:58:43 +02:00
43 rindas
952 B
Java
43 rindas
952 B
Java
import org.aspectj.testing.*;
|
|
public class Finals {
|
|
public static void main(String[] args) {
|
|
new Finals().go(args);
|
|
Tester.checkAllEvents();
|
|
}
|
|
|
|
static {
|
|
Tester.expectEventsInString("go,i1,i2");
|
|
}
|
|
|
|
void go(String[] args) {
|
|
Tester.event("go");
|
|
}
|
|
}
|
|
|
|
interface I {
|
|
public void i();
|
|
}
|
|
aspect Aspect {
|
|
pointcut p1(): call(void go(..)) && target(Finals);
|
|
void around(): p1() {
|
|
new I() {
|
|
public void i() {
|
|
a("i1");
|
|
proceed();
|
|
}
|
|
}.i();
|
|
}
|
|
|
|
pointcut p2(String[] argss): call(void go(String[])) && args(argss) && target(Finals);
|
|
void around(final String[] argss): p2(argss) {
|
|
new I() {
|
|
public void i() {
|
|
a("i2");
|
|
proceed(argss);
|
|
}
|
|
}.i();
|
|
}
|
|
|
|
static void a(String s) { Tester.event(s); }
|
|
}
|