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