mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-27 05:54:38 +02:00
27 lines
543 B
Java
27 lines
543 B
Java
|
// unlock/this
|
||
|
|
||
|
public aspect CombiningPCDs2 {
|
||
|
|
||
|
before(Foo f): unlock() && this(f) {
|
||
|
System.err.println("advice running at "+thisJoinPoint.getSourceLocation());
|
||
|
}
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
Foo aFoo = new Foo();
|
||
|
aFoo.staticM();
|
||
|
aFoo.nonstaticM();
|
||
|
}
|
||
|
|
||
|
static class Foo {
|
||
|
public void nonstaticM() {
|
||
|
synchronized (this) {
|
||
|
System.err.println("non-static method running");
|
||
|
}
|
||
|
}
|
||
|
public static void staticM() {
|
||
|
synchronized (String.class) {
|
||
|
System.err.println("static method running");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|