org.aspectj/tests/features152/synchronization/CombiningPCDs1.java

27 lines
539 B
Java
Raw Normal View History

2006-05-24 09:15:42 +02:00
// lock/this
public aspect CombiningPCDs1 {
before(Foo f): lock() && 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");
}
}
}
}