diff options
Diffstat (limited to 'tests/features152/synchronization/AroundUnlock.java')
-rw-r--r-- | tests/features152/synchronization/AroundUnlock.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/features152/synchronization/AroundUnlock.java b/tests/features152/synchronization/AroundUnlock.java new file mode 100644 index 000000000..a4a3a91a8 --- /dev/null +++ b/tests/features152/synchronization/AroundUnlock.java @@ -0,0 +1,33 @@ +// around advice and unlock + +public aspect AroundUnlock { + + void around(Foo f): unlock() && args(f) { + System.err.println("around(Foo) lock: advice running at "+thisJoinPoint.getSourceLocation()); + proceed(f); + } + + void around(): unlock() { + System.err.println("around() lock: advice running at "+thisJoinPoint.getSourceLocation()); + proceed(); + } + + 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"); + } + } + } +}
\ No newline at end of file |