mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-09-13 15:45:38 +02:00
21 lines
406 B
Java
21 lines
406 B
Java
|
import org.aspectj.testing.Tester;
|
||
|
|
||
|
public class EachJVMOnSelf {
|
||
|
public static void main(String[] args) {
|
||
|
new C();
|
||
|
|
||
|
Tester.checkEqual(A.aspectOf().advisedNewClass, "C");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
aspect A issingleton() {
|
||
|
String advisedNewClass = null;
|
||
|
|
||
|
after () returning (): this(*) && execution(new(..)) {
|
||
|
advisedNewClass = thisJoinPoint.getSourceLocation().getWithinType().getName();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class C {
|
||
|
}
|