summaryrefslogtreecommitdiffstats
path: root/tests/features152/synchronization/BeforeUnlock.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features152/synchronization/BeforeUnlock.java')
-rw-r--r--tests/features152/synchronization/BeforeUnlock.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/features152/synchronization/BeforeUnlock.java b/tests/features152/synchronization/BeforeUnlock.java
new file mode 100644
index 000000000..8ef6401e1
--- /dev/null
+++ b/tests/features152/synchronization/BeforeUnlock.java
@@ -0,0 +1,31 @@
+// before advice and unlock
+
+public aspect BeforeUnlock {
+
+ before(Foo f): unlock() && this(f) {
+ System.err.println("before(Foo) unlock: advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ before(): unlock() {
+ System.err.println("before() unlock: 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