kopie van
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-03 17:56:34 +02:00
57 regels
1.1 KiB
Java
57 regels
1.1 KiB
Java
|
|
import org.aspectj.testing.Tester;
|
|
import java.util.*;
|
|
|
|
/** @testcase PR#883 Getting signature from handler join point */
|
|
public class HandlerSignature {
|
|
|
|
public static void main(String[] args) {
|
|
C c = new C();
|
|
U.ee("caught");
|
|
try {
|
|
c.run();
|
|
} catch (Error e) {
|
|
U.e("caught");
|
|
}
|
|
Tester.checkAllEvents();
|
|
}
|
|
static {
|
|
// U.ee("X");
|
|
}
|
|
}
|
|
|
|
class C {
|
|
public void run() {
|
|
throw new Error("");
|
|
}
|
|
}
|
|
|
|
class U {
|
|
static void e(String event) {
|
|
System.err.println(event);
|
|
Tester.event(event);
|
|
}
|
|
static void ee(String event) {
|
|
Tester.expectEvent(event);
|
|
}
|
|
}
|
|
|
|
aspect A {
|
|
static {
|
|
U.ee("before handler");
|
|
//U.ee("after handler");
|
|
}
|
|
|
|
before() : handler(*) {
|
|
thisJoinPoint.getSignature().getModifiers();
|
|
U.e("before handler");
|
|
}
|
|
/*
|
|
after returning join points not implemented
|
|
after() returning: handler(*) {
|
|
thisJoinPoint.getSignature().getModifiers();
|
|
U.e("after handler");
|
|
}
|
|
*/
|
|
}
|