aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features152
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-24 07:15:42 +0000
committeraclement <aclement>2006-05-24 07:15:42 +0000
commitb2247654a3b35eb26731fac20247fc3007612eab (patch)
tree3b3bc6d6e2833e1d62aaf4506b1e8e3f4d12f51d /tests/features152
parent917a3a70f5c09f16151200f13eb89283c4bb2abf (diff)
downloadaspectj-b2247654a3b35eb26731fac20247fc3007612eab.tar.gz
aspectj-b2247654a3b35eb26731fac20247fc3007612eab.zip
synchronization joinpoints: testcode
Diffstat (limited to 'tests/features152')
-rw-r--r--tests/features152/synchronization/AfterLock.java31
-rw-r--r--tests/features152/synchronization/AfterUnlock.java31
-rw-r--r--tests/features152/synchronization/AroundLock.java41
-rw-r--r--tests/features152/synchronization/AroundUnlock.java33
-rw-r--r--tests/features152/synchronization/Basic.java44
-rw-r--r--tests/features152/synchronization/Basic2.java51
-rw-r--r--tests/features152/synchronization/Basic3.java52
-rw-r--r--tests/features152/synchronization/Basic4.java52
-rw-r--r--tests/features152/synchronization/Basic5.java52
-rw-r--r--tests/features152/synchronization/BasicProgram1.java21
-rw-r--r--tests/features152/synchronization/BeforeLock.java31
-rw-r--r--tests/features152/synchronization/BeforeUnlock.java31
-rw-r--r--tests/features152/synchronization/CombiningPCDs1.java27
-rw-r--r--tests/features152/synchronization/CombiningPCDs2.java27
-rw-r--r--tests/features152/synchronization/LockAspect1.java9
-rw-r--r--tests/features152/synchronization/LockingWithTJP.java28
-rw-r--r--tests/features152/synchronization/Parsing1.java14
-rw-r--r--tests/features152/synchronization/Parsing2.java14
-rw-r--r--tests/features152/synchronization/ParsingAndMatching1.java18
-rw-r--r--tests/features152/synchronization/ParsingAndMatching2.java18
-rw-r--r--tests/features152/synchronization/ParsingAndMatching3.java20
-rw-r--r--tests/features152/synchronization/ParsingAndMatching4.java20
-rw-r--r--tests/features152/synchronization/ThisJoinPointLock.java48
-rw-r--r--tests/features152/synchronization/ThisJoinPointUnlock.java48
-rw-r--r--tests/features152/synchronization/UnlockAspect1.java9
-rw-r--r--tests/features152/synchronization/Useful1.java51
-rw-r--r--tests/features152/synchronization/Useful2.java47
-rw-r--r--tests/features152/synchronization/aop1.xml8
-rw-r--r--tests/features152/synchronization/aop2.xml8
-rw-r--r--tests/features152/synchronization/aop3.xml8
-rw-r--r--tests/features152/synchronization/aop4.xml8
-rw-r--r--tests/features152/synchronization/transformed/Eight.java22
-rw-r--r--tests/features152/synchronization/transformed/Eleven.java22
-rw-r--r--tests/features152/synchronization/transformed/Five.java38
-rw-r--r--tests/features152/synchronization/transformed/Four.java29
-rw-r--r--tests/features152/synchronization/transformed/Investigation.java357
-rw-r--r--tests/features152/synchronization/transformed/Nine.java22
-rw-r--r--tests/features152/synchronization/transformed/One.java39
-rw-r--r--tests/features152/synchronization/transformed/OtherTargeters.java25
-rw-r--r--tests/features152/synchronization/transformed/Seven.java22
-rw-r--r--tests/features152/synchronization/transformed/Six.java26
-rw-r--r--tests/features152/synchronization/transformed/Ten.java22
-rw-r--r--tests/features152/synchronization/transformed/Thirteen.java6
-rw-r--r--tests/features152/synchronization/transformed/Three.java44
-rw-r--r--tests/features152/synchronization/transformed/Twelve.java22
-rw-r--r--tests/features152/synchronization/transformed/Two.java19
-rw-r--r--tests/features152/synchronization/transformed/expected/C.b.txt22
-rw-r--r--tests/features152/synchronization/transformed/expected/C.bbb.txt38
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m.txt23
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m2.txt28
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m3.txt23
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m32.txt28
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m33.txt24
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m34.txt26
-rw-r--r--tests/features152/synchronization/transformed/expected/C.m4.txt26
-rw-r--r--tests/features152/synchronization/transformed/expected/C.ma.txt22
-rw-r--r--tests/features152/synchronization/transformed/expected/Investigation.b.txt21
-rw-r--r--tests/features152/synchronization/transformed/expected/Investigation.c.txt35
-rw-r--r--tests/features152/synchronization/transformed/expected/Investigation.d.txt38
-rw-r--r--tests/features152/synchronization/transformed/expected/Investigation.e.txt40
-rw-r--r--tests/features152/synchronization/transformed/expected/One.b.txt22
-rw-r--r--tests/features152/synchronization/transformed/expected/One.c.txt36
-rw-r--r--tests/features152/synchronization/transformed/expected/One.e.txt43
63 files changed, 2110 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
diff --git a/tests/features152/synchronization/AfterUnlock.java b/tests/features152/synchronization/AfterUnlock.java
new file mode 100644
index 000000000..5463a3215
--- /dev/null
+++ b/tests/features152/synchronization/AfterUnlock.java
@@ -0,0 +1,31 @@
+// after advice and unlock
+
+public aspect AfterUnlock {
+
+ after(Foo f): unlock() && this(f) {
+ System.err.println("after(Foo) unlock: advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ after(): unlock() {
+ System.err.println("after() 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
diff --git a/tests/features152/synchronization/AroundLock.java b/tests/features152/synchronization/AroundLock.java
new file mode 100644
index 000000000..048fc8cd5
--- /dev/null
+++ b/tests/features152/synchronization/AroundLock.java
@@ -0,0 +1,41 @@
+// around advice and lock
+
+public aspect AroundLock {
+
+ String s = "foo";
+// void around(Object f): lock() && args(f) {
+// System.err.println("around(Object) lock: advice running at "+thisJoinPoint.getSourceLocation());
+// proceed(f);
+// }
+
+ void around(Object f): lock() && args(f){
+ System.err.println("around() lock: advice running at "+thisJoinPoint.getSourceLocation());
+ proceed(s);
+ proceed(s);
+ }
+
+ void around(Object f): unlock() && args(f) {
+ System.err.println("around() unlock: advice running at "+thisJoinPoint.getSourceLocation());
+ proceed(s);
+ proceed(s);
+ }
+
+ 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
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
diff --git a/tests/features152/synchronization/Basic.java b/tests/features152/synchronization/Basic.java
new file mode 100644
index 000000000..3af3d523c
--- /dev/null
+++ b/tests/features152/synchronization/Basic.java
@@ -0,0 +1,44 @@
+// Exploring synchronization
+
+public class Basic {
+ public static void main(String[] args) {
+ Basic b = new Basic();
+
+ b.methodWithSyncBlock1();
+ b.staticMethodWithSyncBlock1();
+ b.methodWithSyncBlock2();
+ b.staticMethodWithSyncBlock2();
+ }
+
+ public void methodWithSyncBlock1() {
+ System.err.println("methodWithSyncBlock1");
+ synchronized (this) {
+ }
+ }
+
+ public void staticMethodWithSyncBlock1() {
+ System.err.println("staticMethodWithSyncBlock1");
+ synchronized (Basic.class) {
+ }
+ }
+
+ public void methodWithSyncBlock2() {
+ System.err.println("methodWithSyncBlock2");
+ synchronized (this) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+
+ public void staticMethodWithSyncBlock2() {
+ System.err.println("staticMethodWithSyncBlock2");
+ synchronized (Basic.class) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+}
diff --git a/tests/features152/synchronization/Basic2.java b/tests/features152/synchronization/Basic2.java
new file mode 100644
index 000000000..c7fade755
--- /dev/null
+++ b/tests/features152/synchronization/Basic2.java
@@ -0,0 +1,51 @@
+// Exploring synchronization
+
+aspect WithinAspect {
+ before(): within(Basic2) {
+ if (thisJoinPoint.toString().indexOf("lock(")!=-1)
+ System.err.println("Advice running at "+thisJoinPoint.getSignature());
+ }
+}
+
+public class Basic2 {
+ public static void main(String[] args) {
+ Basic2 b = new Basic2();
+
+ b.methodWithSyncBlock1();
+ b.staticMethodWithSyncBlock1();
+ b.methodWithSyncBlock2();
+ b.staticMethodWithSyncBlock2();
+ }
+
+ public void methodWithSyncBlock1() {
+ System.err.println("methodWithSyncBlock1");
+ synchronized (this) {
+ }
+ }
+
+ public void staticMethodWithSyncBlock1() {
+ System.err.println("staticMethodWithSyncBlock1");
+ synchronized (Basic2.class) {
+ }
+ }
+
+ public void methodWithSyncBlock2() {
+ System.err.println("methodWithSyncBlock2");
+ synchronized (this) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+
+ public void staticMethodWithSyncBlock2() {
+ System.err.println("staticMethodWithSyncBlock2");
+ synchronized (Basic2.class) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+}
diff --git a/tests/features152/synchronization/Basic3.java b/tests/features152/synchronization/Basic3.java
new file mode 100644
index 000000000..01c196715
--- /dev/null
+++ b/tests/features152/synchronization/Basic3.java
@@ -0,0 +1,52 @@
+// Exploring synchronization
+
+aspect WithinAspect {
+ before(Object o ): within(Basic3) && this(o) {
+ if (thisJoinPoint.getSignature().toString().indexOf("lock(")!=-1)
+ System.err.println("Advice running at "+thisJoinPoint.getSignature()+
+ " with this of type "+o.getClass()+" with value "+o);
+ }
+}
+
+public class Basic3 {
+ public static void main(String[] args) {
+ Basic3 b = new Basic3();
+
+ b.methodWithSyncBlock1();
+ b.staticMethodWithSyncBlock1();
+ b.methodWithSyncBlock2();
+ b.staticMethodWithSyncBlock2();
+ }
+
+ public void methodWithSyncBlock1() {
+ System.err.println("methodWithSyncBlock1");
+ synchronized (this) {
+ }
+ }
+
+ public void staticMethodWithSyncBlock1() {
+ System.err.println("staticMethodWithSyncBlock1");
+ synchronized (Basic3.class) {
+ }
+ }
+
+ public void methodWithSyncBlock2() {
+ System.err.println("methodWithSyncBlock2");
+ synchronized (this) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+
+ public void staticMethodWithSyncBlock2() {
+ System.err.println("staticMethodWithSyncBlock2");
+ synchronized (Basic3.class) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+}
diff --git a/tests/features152/synchronization/Basic4.java b/tests/features152/synchronization/Basic4.java
new file mode 100644
index 000000000..787f550a8
--- /dev/null
+++ b/tests/features152/synchronization/Basic4.java
@@ -0,0 +1,52 @@
+// Exploring synchronization
+
+aspect WithinAspect {
+ before(Object o ): within(Basic4) && args(o) {
+ if (thisJoinPoint.getSignature().toString().indexOf("lock(")!=-1)
+ System.err.println("Advice running at "+thisJoinPoint.getSignature()+
+ " with args of type "+o.getClass()+" with value "+o);
+ }
+}
+
+public class Basic4 {
+ public static void main(String[] args) {
+ Basic4 b = new Basic4();
+
+ b.methodWithSyncBlock1();
+ b.staticMethodWithSyncBlock1();
+ b.methodWithSyncBlock2();
+ b.staticMethodWithSyncBlock2();
+ }
+
+ public void methodWithSyncBlock1() {
+ System.err.println("methodWithSyncBlock1");
+ synchronized (this) {
+ }
+ }
+
+ public void staticMethodWithSyncBlock1() {
+ System.err.println("staticMethodWithSyncBlock1");
+ synchronized (Basic4.class) {
+ }
+ }
+
+ public void methodWithSyncBlock2() {
+ System.err.println("methodWithSyncBlock2");
+ synchronized (this) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+
+ public void staticMethodWithSyncBlock2() {
+ System.err.println("staticMethodWithSyncBlock2");
+ synchronized (Basic4.class) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+}
diff --git a/tests/features152/synchronization/Basic5.java b/tests/features152/synchronization/Basic5.java
new file mode 100644
index 000000000..062b32014
--- /dev/null
+++ b/tests/features152/synchronization/Basic5.java
@@ -0,0 +1,52 @@
+// Exploring synchronization
+
+aspect WithinAspect {
+ before(Object o ): within(Basic5) && target(o) {
+ if (thisJoinPoint.getSignature().toString().indexOf("lock")!=-1)
+ System.err.println("Advice running at "+thisJoinPoint.getSignature()+
+ " with target of type "+o.getClass()+" with value "+o);
+ }
+}
+
+public class Basic5 {
+ public static void main(String[] args) {
+ Basic5 b = new Basic5();
+
+ b.methodWithSyncBlock1();
+ b.staticMethodWithSyncBlock1();
+ b.methodWithSyncBlock2();
+ b.staticMethodWithSyncBlock2();
+ }
+
+ public void methodWithSyncBlock1() {
+ System.err.println("methodWithSyncBlock1");
+ synchronized (this) {
+ }
+ }
+
+ public void staticMethodWithSyncBlock1() {
+ System.err.println("staticMethodWithSyncBlock1");
+ synchronized (Basic5.class) {
+ }
+ }
+
+ public void methodWithSyncBlock2() {
+ System.err.println("methodWithSyncBlock2");
+ synchronized (this) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+
+ public void staticMethodWithSyncBlock2() {
+ System.err.println("staticMethodWithSyncBlock2");
+ synchronized (Basic5.class) {
+ int i = 0;
+ while (i<100) {
+ i++;
+ }
+ }
+ }
+}
diff --git a/tests/features152/synchronization/BasicProgram1.java b/tests/features152/synchronization/BasicProgram1.java
new file mode 100644
index 000000000..7e1491300
--- /dev/null
+++ b/tests/features152/synchronization/BasicProgram1.java
@@ -0,0 +1,21 @@
+// Subject to LTW
+
+public class BasicProgram1 {
+
+ public static void main(String[] args) {
+ new BasicProgram1().nonstaticM();
+ staticM();
+ }
+
+ public static void staticM() {
+ synchronized (String.class) {
+ System.err.println("static method running");
+ }
+ }
+
+ public void nonstaticM() {
+ synchronized (this) {
+ System.err.println("nonstatic method running");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/BeforeLock.java b/tests/features152/synchronization/BeforeLock.java
new file mode 100644
index 000000000..334137ad1
--- /dev/null
+++ b/tests/features152/synchronization/BeforeLock.java
@@ -0,0 +1,31 @@
+// before advice and lock
+
+public aspect BeforeLock {
+
+ before(Foo f): lock() && this(f) {
+ System.err.println("before(Foo) lock: advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ before(): lock() {
+ System.err.println("before() 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
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
diff --git a/tests/features152/synchronization/CombiningPCDs1.java b/tests/features152/synchronization/CombiningPCDs1.java
new file mode 100644
index 000000000..153c6134b
--- /dev/null
+++ b/tests/features152/synchronization/CombiningPCDs1.java
@@ -0,0 +1,27 @@
+// 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");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/CombiningPCDs2.java b/tests/features152/synchronization/CombiningPCDs2.java
new file mode 100644
index 000000000..bd0653eed
--- /dev/null
+++ b/tests/features152/synchronization/CombiningPCDs2.java
@@ -0,0 +1,27 @@
+// 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");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/LockAspect1.java b/tests/features152/synchronization/LockAspect1.java
new file mode 100644
index 000000000..a1b0bbc08
--- /dev/null
+++ b/tests/features152/synchronization/LockAspect1.java
@@ -0,0 +1,9 @@
+// to be LTW with BasicProgram1
+import org.aspectj.lang.annotation.*;
+
+public aspect LockAspect1 {
+ @SuppressAjWarnings("adviceDidNotMatch")
+ before(): lock() {
+ System.err.println("Lock advice running at "+thisJoinPoint.getSourceLocation());
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/LockingWithTJP.java b/tests/features152/synchronization/LockingWithTJP.java
new file mode 100644
index 000000000..a07b567ce
--- /dev/null
+++ b/tests/features152/synchronization/LockingWithTJP.java
@@ -0,0 +1,28 @@
+// obtaining the object being locked on
+
+public aspect LockingWithTJP {
+
+ before(): lock() {
+ System.err.println("before() lock: advice running at "+thisJoinPoint.getSourceLocation());
+ System.err.println("Locked on "+thisJoinPoint.getArgs()[0]);
+ }
+
+ public static void main(String[] args) {
+ Foo aFoo = new Foo();
+ aFoo.nonstaticM();
+ aFoo.staticM();
+ }
+
+ 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
diff --git a/tests/features152/synchronization/Parsing1.java b/tests/features152/synchronization/Parsing1.java
new file mode 100644
index 000000000..a1ee5fdfd
--- /dev/null
+++ b/tests/features152/synchronization/Parsing1.java
@@ -0,0 +1,14 @@
+// Exploring synchronization
+
+public aspect Parsing1 {
+
+ before(): lock() { }
+
+ public static void main(String[] args) {
+ staticM();
+ }
+
+ public static void staticM() {
+// synchronized (String.class) {}
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/Parsing2.java b/tests/features152/synchronization/Parsing2.java
new file mode 100644
index 000000000..f0d4a1cbb
--- /dev/null
+++ b/tests/features152/synchronization/Parsing2.java
@@ -0,0 +1,14 @@
+// Exploring synchronization
+
+public aspect Parsing2 {
+
+ before(): unlock() { }
+
+ public static void main(String[] args) {
+ staticM();
+ }
+
+ public static void staticM() {
+// synchronized (String.class) {}
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/ParsingAndMatching1.java b/tests/features152/synchronization/ParsingAndMatching1.java
new file mode 100644
index 000000000..9c6ab82aa
--- /dev/null
+++ b/tests/features152/synchronization/ParsingAndMatching1.java
@@ -0,0 +1,18 @@
+// lock and static context
+
+public aspect ParsingAndMatching1 {
+
+ before(): lock() {
+ System.err.println("Advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ public static void main(String[] args) {
+ staticM();
+ }
+
+ public static void staticM() {
+ synchronized (String.class) {
+ System.err.println("static method running");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/ParsingAndMatching2.java b/tests/features152/synchronization/ParsingAndMatching2.java
new file mode 100644
index 000000000..87599cb07
--- /dev/null
+++ b/tests/features152/synchronization/ParsingAndMatching2.java
@@ -0,0 +1,18 @@
+// unlock and static context
+
+public aspect ParsingAndMatching2 {
+
+ before(): unlock() {
+ System.err.println("Advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ public static void main(String[] args) {
+ staticM();
+ }
+
+ public static void staticM() {
+ synchronized (String.class) {
+ System.err.println("static method running");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/ParsingAndMatching3.java b/tests/features152/synchronization/ParsingAndMatching3.java
new file mode 100644
index 000000000..7a6fee6c2
--- /dev/null
+++ b/tests/features152/synchronization/ParsingAndMatching3.java
@@ -0,0 +1,20 @@
+// lock and non-static context
+
+public aspect ParsingAndMatching3 {
+
+ before(): lock() {
+ System.err.println("Advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ public static void main(String[] args) {
+ new Foo().nonstaticM();
+ }
+
+ static class Foo {
+ public void nonstaticM() {
+ synchronized (String.class) {
+ System.err.println("non-static method running");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/ParsingAndMatching4.java b/tests/features152/synchronization/ParsingAndMatching4.java
new file mode 100644
index 000000000..4fe3c6f5d
--- /dev/null
+++ b/tests/features152/synchronization/ParsingAndMatching4.java
@@ -0,0 +1,20 @@
+// unlock and non-static context
+
+public aspect ParsingAndMatching4 {
+
+ before(): unlock() {
+ System.err.println("Advice running at "+thisJoinPoint.getSourceLocation());
+ }
+
+ public static void main(String[] args) {
+ new Foo().nonstaticM();
+ }
+
+ static class Foo {
+ public void nonstaticM() {
+ synchronized (String.class) {
+ System.err.println("non-static method running");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/ThisJoinPointLock.java b/tests/features152/synchronization/ThisJoinPointLock.java
new file mode 100644
index 000000000..ed5376a79
--- /dev/null
+++ b/tests/features152/synchronization/ThisJoinPointLock.java
@@ -0,0 +1,48 @@
+import org.aspectj.lang.reflect.*;
+
+aspect TJPAspect {
+ before(): withincode(void ThisJoinPointLock.nonStaticMethod()) {
+ if (thisJoinPoint.getSignature() instanceof LockSignature) {
+ System.err.println("match.toString(): "+thisJoinPoint.toString());
+ System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
+ System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
+ }
+
+ // SHORT => shorttypenames, no args, no throws, no modifiers, short type names
+ // MIDDLE=> args included
+ // LONG => modifiers included
+ }
+
+// before(): withincode(void ThisJoinPointLock.nonStaticMethod()) {
+// if (thisJoinPoint.getSignature() instanceof MethodSignature) {
+// System.err.println("match.toString(): "+thisJoinPoint.toString());
+// System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
+// System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
+// }
+//
+// // SHORT => shorttypenames, no args, no throws, no modifiers, short type names
+// // MIDDLE=> args included
+// // LONG => modifiers included
+// }
+
+}
+
+public class ThisJoinPointLock {
+ public static void main(String[] args) {
+ ThisJoinPointLock b = new ThisJoinPointLock();
+ b.nonStaticMethod();
+ b.staticMethod();
+ }
+
+ public void nonStaticMethod() {
+ synchronized (this) {
+ staticMethod();
+ }
+ }
+
+ public void staticMethod() {
+ synchronized (ThisJoinPointLock.class) {
+ }
+ }
+
+}
diff --git a/tests/features152/synchronization/ThisJoinPointUnlock.java b/tests/features152/synchronization/ThisJoinPointUnlock.java
new file mode 100644
index 000000000..46bee3da5
--- /dev/null
+++ b/tests/features152/synchronization/ThisJoinPointUnlock.java
@@ -0,0 +1,48 @@
+import org.aspectj.lang.reflect.*;
+
+aspect TJPAspect {
+ before(): withincode(void ThisJoinPointUnlock.nonStaticMethod()) {
+ if (thisJoinPoint.getSignature() instanceof UnlockSignature) {
+ System.err.println("match.toString(): "+thisJoinPoint.toString());
+ System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
+ System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
+ }
+
+ // SHORT => shorttypenames, no args, no throws, no modifiers, short type names
+ // MIDDLE=> args included
+ // LONG => modifiers included
+ }
+
+// before(): withincode(void ThisJoinPointLock.nonStaticMethod()) {
+// if (thisJoinPoint.getSignature() instanceof MethodSignature) {
+// System.err.println("match.toString(): "+thisJoinPoint.toString());
+// System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
+// System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
+// }
+//
+// // SHORT => shorttypenames, no args, no throws, no modifiers, short type names
+// // MIDDLE=> args included
+// // LONG => modifiers included
+// }
+
+}
+
+public class ThisJoinPointUnlock {
+ public static void main(String[] args) {
+ ThisJoinPointUnlock b = new ThisJoinPointUnlock();
+ b.nonStaticMethod();
+ b.staticMethod();
+ }
+
+ public void nonStaticMethod() {
+ synchronized (this) {
+ staticMethod();
+ }
+ }
+
+ public void staticMethod() {
+ synchronized (ThisJoinPointUnlock.class) {
+ }
+ }
+
+}
diff --git a/tests/features152/synchronization/UnlockAspect1.java b/tests/features152/synchronization/UnlockAspect1.java
new file mode 100644
index 000000000..b91e0a1e2
--- /dev/null
+++ b/tests/features152/synchronization/UnlockAspect1.java
@@ -0,0 +1,9 @@
+// to be LTW with BasicProgram1
+import org.aspectj.lang.annotation.*;
+
+public aspect UnlockAspect1 {
+ @SuppressAjWarnings("adviceDidNotMatch")
+ before(): unlock() {
+ System.err.println("Unlock advice running at "+thisJoinPoint.getSourceLocation());
+ }
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/Useful1.java b/tests/features152/synchronization/Useful1.java
new file mode 100644
index 000000000..d8ecbe3a0
--- /dev/null
+++ b/tests/features152/synchronization/Useful1.java
@@ -0,0 +1,51 @@
+// Exploring synchronization
+
+aspect WithinAspect {
+ long locktimer = 0;
+ int iterations = 0;
+ Object currentObject = null;
+ boolean didSomething = false;
+ long activeTimer;
+
+ before(Object o ): within(Useful1) && args(o) {
+ if (thisJoinPoint.getSignature().toString().startsWith("lock(")) {
+ activeTimer = System.currentTimeMillis();
+ didSomething = true;
+ }
+ }
+
+ after(Object o ): within(Useful1) && args(o) {
+ if (thisJoinPoint.getSignature().toString().startsWith("unlock(")) {
+ if (activeTimer!=0) {
+ locktimer+=(System.currentTimeMillis()-activeTimer);
+ iterations++;
+ activeTimer=0;
+ didSomething = true;
+ }
+ }
+ }
+
+ after() returning: execution(* main(..)) {
+ System.err.println("Average lock taking time over "+iterations+" iterations is "+
+ (((double)locktimer)/
+ ((double)iterations))+"ms");
+ if (didSomething) System.err.println("We did time something!"); // can write a test looking for this line, it won't vary
+ }
+}
+
+public class Useful1 {
+ public static void main(String[] args) {
+ Useful1 u = new Useful1();
+
+ for (int i = 0; i < 2000; i++) {
+ u.methodWithSynchronizedBlock();
+ }
+ }
+
+ public void methodWithSynchronizedBlock() {
+ synchronized (this) {
+ for (int ii=0;ii<100;ii++);
+ }
+ }
+
+}
diff --git a/tests/features152/synchronization/Useful2.java b/tests/features152/synchronization/Useful2.java
new file mode 100644
index 000000000..46fc82d5a
--- /dev/null
+++ b/tests/features152/synchronization/Useful2.java
@@ -0,0 +1,47 @@
+// Exploring synchronization
+
+aspect LockMonitor {
+ long locktimer = 0;
+ int iterations = 0;
+ Object currentObject = null;
+ long activeTimer;
+
+ before(Useful2 o ): lock() && args(o) {
+ activeTimer = System.currentTimeMillis();
+ currentObject = o;
+ }
+
+ after(Useful2 o ): unlock() && args(o) {
+ if (o!=currentObject) {
+ throw new RuntimeException("Unlocking on incorrect thing?!?");
+ }
+ if (activeTimer!=0) {
+ locktimer+=(System.currentTimeMillis()-activeTimer);
+ iterations++;
+ activeTimer=0;
+ }
+ }
+
+ after() returning: execution(* main(..)) {
+ System.err.println("Average time spent with lock over "+iterations+" iterations is "+
+ (((double)locktimer)/
+ ((double)iterations))+"ms");
+ }
+}
+
+public class Useful2 {
+ public static void main(String[] args) {
+ Useful2 u = new Useful2();
+
+ for (int i = 0; i < 20; i++) {
+ u.methodWithSynchronizedBlock();
+ }
+ }
+
+ public void methodWithSynchronizedBlock() {
+ synchronized (this) {
+ for (int ii=0;ii<1000000;ii++);
+ }
+ }
+
+}
diff --git a/tests/features152/synchronization/aop1.xml b/tests/features152/synchronization/aop1.xml
new file mode 100644
index 000000000..c4c26ddaa
--- /dev/null
+++ b/tests/features152/synchronization/aop1.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <aspect name="LockAspect1"/>
+ </aspects>
+
+ <weaver options="-showWeaveInfo ">
+ </weaver>
+</aspectj> \ No newline at end of file
diff --git a/tests/features152/synchronization/aop2.xml b/tests/features152/synchronization/aop2.xml
new file mode 100644
index 000000000..1488e6e22
--- /dev/null
+++ b/tests/features152/synchronization/aop2.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <aspect name="UnlockAspect1"/>
+ </aspects>
+
+ <weaver options="-showWeaveInfo">
+ </weaver>
+</aspectj> \ No newline at end of file
diff --git a/tests/features152/synchronization/aop3.xml b/tests/features152/synchronization/aop3.xml
new file mode 100644
index 000000000..e07f8feae
--- /dev/null
+++ b/tests/features152/synchronization/aop3.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <aspect name="LockAspect1"/>
+ </aspects>
+
+ <weaver options=" -showWeaveInfo -Xjoinpoints:synchronization,trivial">
+ </weaver>
+</aspectj> \ No newline at end of file
diff --git a/tests/features152/synchronization/aop4.xml b/tests/features152/synchronization/aop4.xml
new file mode 100644
index 000000000..892a16a0d
--- /dev/null
+++ b/tests/features152/synchronization/aop4.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <aspect name="UnlockAspect1"/>
+ </aspects>
+
+ <weaver options=" -showWeaveInfo -Xjoinpoints:synchronization">
+ </weaver>
+</aspectj> \ No newline at end of file
diff --git a/tests/features152/synchronization/transformed/Eight.java b/tests/features152/synchronization/transformed/Eight.java
new file mode 100644
index 000000000..79af0a625
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Eight.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching unlock in a transformed non-static method...
+
+public aspect Eight {
+ public static void main(String[] args) {
+ new C().b();
+ }
+
+ before(): !within(Eight) && unlock() {
+ System.err.println("Unlocking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/Eleven.java b/tests/features152/synchronization/transformed/Eleven.java
new file mode 100644
index 000000000..e9a3fa85a
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Eleven.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching lock on transformed static method ( pre J5)
+
+public aspect Eleven {
+ public static void main(String[] args) {
+ C.b();
+ }
+
+ before(): !within(Eleven) && lock() {
+ System.err.println("Locking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public static synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/Five.java b/tests/features152/synchronization/transformed/Five.java
new file mode 100644
index 000000000..e5e30c6f5
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Five.java
@@ -0,0 +1,38 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect Five {
+ public static void main(String[] args) {
+ C.b();
+ C.c();
+ C.d();
+ C.e();
+ }
+
+ before(): !within(Five) && call(* println(..)) { System.err.println("test");}
+}
+
+class C {
+ public static synchronized void b() {
+ System.err.println("hello");
+ }
+
+ public static void c() {
+ synchronized (C.class) {
+ System.err.println("hello");
+ }
+ }
+ public static void d() {
+ synchronized (String.class) {
+ System.err.println("hello");
+ }
+ }
+ public static void e() {
+ synchronized (Five.class) {
+ System.err.println("hello");
+ }
+ }
+}
+
+aspect FiveX { pointcut p(): unlock(); }
diff --git a/tests/features152/synchronization/transformed/Four.java b/tests/features152/synchronization/transformed/Four.java
new file mode 100644
index 000000000..454fdb1f1
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Four.java
@@ -0,0 +1,29 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect Four {
+ public static void main(String[] args) {
+ new C().m();
+ try {new C().m2(); } catch (MyException me) {int i=1;}
+ }
+ after() returning: execution(synchronized * m(..)) { System.err.println("execution advice running1");}
+ after() throwing: execution(synchronized * m2(..)) { System.err.println("execution advice running2");}
+}
+
+class C {
+
+ public synchronized void m() {
+ System.err.println("hello");
+ }
+
+ public synchronized void m2() {
+ System.err.println("hello");
+ throw new MyException();
+ }
+
+}
+
+class MyException extends RuntimeException { }
+
+aspect FourX { pointcut p(): lock(); }
diff --git a/tests/features152/synchronization/transformed/Investigation.java b/tests/features152/synchronization/transformed/Investigation.java
new file mode 100644
index 000000000..1fad31a6f
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Investigation.java
@@ -0,0 +1,357 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public class Investigation {
+ public static void main(String[] args) {
+
+ }
+
+
+ // Basic synchronized method
+ public void a() {
+ synchronized (this) {
+
+ }
+ }
+
+ // ... that does something ...
+ public void b() {
+ synchronized (this) {
+ System.out.println("hello");
+ }
+ }
+
+ // ... that includes try/catch ...
+ public void c() {
+ synchronized(this) {
+ try {
+ File f = new File("fred");
+ FileInputStream fis = new FileInputStream(f);
+ } catch (IOException ioe) {
+ System.out.println("bang");
+ }
+ }
+ }
+
+ // ... with multiple synchronized blocks ...
+ public void d() {
+ synchronized (this) {
+ System.out.println("hello");
+ }
+ synchronized (this) {
+ System.out.println("world");
+ }
+ }
+
+ // ... with nested synchronized blocks ...
+ public void e() {
+ synchronized (this) {
+ System.out.println("hello");
+ synchronized (new String()) {
+ System.out.println("other");
+ }
+ }
+ }
+
+ /*
+ Compiled from "Investigation.java"
+ public class Investigation extends java.lang.Object
+ SourceFile: "Investigation.java"
+ minor version: 0
+ major version: 46
+ Constant pool:
+ const #1 = Asciz Investigation;
+ const #2 = class #1; // Investigation
+ const #3 = Asciz java/lang/Object;
+ const #4 = class #3; // java/lang/Object
+ const #5 = Asciz <init>;
+ const #6 = Asciz ()V;
+ const #7 = Asciz Code;
+ const #8 = NameAndType #5:#6;// "<init>":()V
+ const #9 = Method #4.#8; // java/lang/Object."<init>":()V
+ const #10 = Asciz LineNumberTable;
+ const #11 = Asciz LocalVariableTable;
+ const #12 = Asciz this;
+ const #13 = Asciz LInvestigation;;
+ const #14 = Asciz main;
+ const #15 = Asciz ([Ljava/lang/String;)V;
+ const #16 = Asciz org.aspectj.weaver.MethodDeclarationLineNumber;
+ const #17 = Asciz args;
+ const #18 = Asciz [Ljava/lang/String;;
+ const #19 = Asciz a;
+ const #20 = Asciz b;
+ const #21 = Asciz java/lang/System;
+ const #22 = class #21; // java/lang/System
+ const #23 = Asciz out;
+ const #24 = Asciz Ljava/io/PrintStream;;
+ const #25 = NameAndType #23:#24;// out:Ljava/io/PrintStream;
+ const #26 = Field #22.#25; // java/lang/System.out:Ljava/io/PrintStream;
+ const #27 = Asciz hello;
+ const #28 = String #27; // hello
+ const #29 = Asciz java/io/PrintStream;
+ const #30 = class #29; // java/io/PrintStream
+ const #31 = Asciz println;
+ const #32 = Asciz (Ljava/lang/String;)V;
+ const #33 = NameAndType #31:#32;// println:(Ljava/lang/String;)V
+ const #34 = Method #30.#33; // java/io/PrintStream.println:(Ljava/lang/String;)V
+ const #35 = Asciz c;
+ const #36 = Asciz java/io/File;
+ const #37 = class #36; // java/io/File
+ const #38 = Asciz fred;
+ const #39 = String #38; // fred
+ const #40 = NameAndType #5:#32;// "<init>":(Ljava/lang/String;)V
+ const #41 = Method #37.#40; // java/io/File."<init>":(Ljava/lang/String;)V
+ const #42 = Asciz java/io/FileInputStream;
+ const #43 = class #42; // java/io/FileInputStream
+ const #44 = Asciz (Ljava/io/File;)V;
+ const #45 = NameAndType #5:#44;// "<init>":(Ljava/io/File;)V
+ const #46 = Method #43.#45; // java/io/FileInputStream."<init>":(Ljava/io/File;)V
+ const #47 = Asciz bang;
+ const #48 = String #47; // bang
+ const #49 = Asciz java/io/IOException;
+ const #50 = class #49; // java/io/IOException
+ const #51 = Asciz f;
+ const #52 = Asciz Ljava/io/File;;
+ const #53 = Asciz d;
+ const #54 = Asciz world;
+ const #55 = String #54; // world
+ const #56 = Asciz e;
+ const #57 = Asciz java/lang/String;
+ const #58 = class #57; // java/lang/String
+ const #59 = Method #58.#8; // java/lang/String."<init>":()V
+ const #60 = Asciz other;
+ const #61 = String #60; // other
+ const #62 = Asciz SourceFile;
+ const #63 = Asciz Investigation.java;
+
+ {
+ public Investigation();
+ Code:
+ Stack=1, Locals=1, Args_size=1
+ 0: aload_0
+ 1: invokespecial #9; //Method java/lang/Object."<init>":()V
+ 4: return
+ LineNumberTable:
+ line 5: 0
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this LInvestigation;
+
+ public static void main(java.lang.String[]);
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 06 00 00 00 FFFFFF88
+ Code:
+ Stack=0, Locals=1, Args_size=1
+ 0: return
+ LineNumberTable:
+ line 8: 0
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 1 0 args [Ljava/lang/String;
+
+ public void a();
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 0C 00 00 00 FFFFFFD9
+ Code:
+ Stack=2, Locals=1, Args_size=1
+ 0: aload_0
+ 1: dup
+ 2: monitorenter
+ 3: monitorexit
+ 4: return
+ LineNumberTable:
+ line 13: 0
+ line 16: 4
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this LInvestigation;
+
+ public void b();
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 13 00 00 01 38
+ Code:
+ Stack=2, Locals=2, Args_size=1
+ 0: aload_0
+ 1: dup
+ 2: astore_1
+ 3: monitorenter
+ 4: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 7: ldc #28; //String hello
+ 9: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 12: aload_1
+ 13: monitorexit
+ 14: goto 20
+ 17: aload_1
+ 18: monitorexit
+ 19: athrow
+ 20: return
+ Exception table:
+ from to target type
+ 4 14 17 any
+ 17 19 17 any
+ LineNumberTable:
+ line 20: 0
+ line 21: 4
+ line 20: 12
+ line 23: 20
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 21 0 this LInvestigation;
+
+ public void c();
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 1A 00 00 01 FFFFFFB7
+ Code:
+ Stack=3, Locals=3, Args_size=1
+ 0: aload_0
+ 1: dup
+ 2: astore_1
+ 3: monitorenter
+ 4: new #37; //class java/io/File
+ 7: dup
+ 8: ldc #39; //String fred
+ 10: invokespecial #41; //Method java/io/File."<init>":(Ljava/lang/String;)V
+ 13: astore_2
+ 14: new #43; //class java/io/FileInputStream
+ 17: dup
+ 18: aload_2
+ 19: invokespecial #46; //Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
+ 22: pop
+ 23: goto 35
+ 26: pop
+ 27: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 30: ldc #48; //String bang
+ 32: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 35: aload_1
+ 36: monitorexit
+ 37: goto 43
+ 40: aload_1
+ 41: monitorexit
+ 42: athrow
+ 43: return
+ Exception table:
+ from to target type
+ 4 26 26 Class java/io/IOException
+
+ 4 37 40 any
+ 40 42 40 any
+ LineNumberTable:
+ line 27: 0
+ line 29: 4
+ line 30: 14
+ line 31: 26
+ line 32: 27
+ line 27: 35
+ line 35: 43
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 44 0 this LInvestigation;
+ 14 12 2 f Ljava/io/File;
+
+ public void d();
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 26 00 00 02 FFFFFFC2
+ Code:
+ Stack=2, Locals=2, Args_size=1
+ 0: aload_0
+ 1: dup
+ 2: astore_1
+ 3: monitorenter
+ 4: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 7: ldc #28; //String hello
+ 9: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 12: aload_1
+ 13: monitorexit
+ 14: goto 20
+ 17: aload_1
+ 18: monitorexit
+ 19: athrow
+ 20: aload_0
+ 21: dup
+ 22: astore_1
+ 23: monitorenter
+ 24: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 27: ldc #55; //String world
+ 29: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 32: aload_1
+ 33: monitorexit
+ 34: goto 40
+ 37: aload_1
+ 38: monitorexit
+ 39: athrow
+ 40: return
+ Exception table:
+ from to target type
+ 4 14 17 any
+ 17 19 17 any
+ 24 34 37 any
+ 37 39 37 any
+ LineNumberTable:
+ line 39: 0
+ line 40: 4
+ line 39: 12
+ line 42: 20
+ line 43: 24
+ line 42: 32
+ line 45: 40
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 41 0 this LInvestigation;
+
+ public void e();
+ org.aspectj.weaver.MethodDeclarationLineNumber: length = 0x8
+ 00 00 00 30 00 00 03 FFFFFF88
+ Code:
+ Stack=2, Locals=3, Args_size=1
+ 0: aload_0
+ 1: dup
+ 2: astore_1
+ 3: monitorenter
+ 4: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 7: ldc #28; //String hello
+ 9: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 12: new #58; //class java/lang/String
+ 15: dup
+ 16: invokespecial #59; //Method java/lang/String."<init>":()V
+ 19: dup
+ 20: astore_2
+ 21: monitorenter
+ 22: getstatic #26; //Field java/lang/System.out:Ljava/io/PrintStream;
+ 25: ldc #61; //String other
+ 27: invokevirtual #34; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
+ 30: aload_2
+ 31: monitorexit
+ 32: goto 38
+ 35: aload_2
+ 36: monitorexit
+ 37: athrow
+ 38: aload_1
+ 39: monitorexit
+ 40: goto 46
+ 43: aload_1
+ 44: monitorexit
+ 45: athrow
+ 46: return
+ Exception table:
+ from to target type
+ 22 32 35 any
+ 35 37 35 any
+ 4 40 43 any
+ 43 45 43 any
+ LineNumberTable:
+ line 49: 0
+ line 50: 4
+ line 51: 12
+ line 52: 22
+ line 51: 30
+ line 49: 38
+ line 55: 46
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 47 0 this LInvestigation;
+
+ }
+*/
+
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/transformed/Nine.java b/tests/features152/synchronization/transformed/Nine.java
new file mode 100644
index 000000000..8bd5fdf64
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Nine.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching lock on transformed static method (J5)
+
+public aspect Nine {
+ public static void main(String[] args) {
+ C.b();
+ }
+
+ before(): !within(Nine) && lock() {
+ System.err.println("Locking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public static synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/One.java b/tests/features152/synchronization/transformed/One.java
new file mode 100644
index 000000000..49a80c9d7
--- /dev/null
+++ b/tests/features152/synchronization/transformed/One.java
@@ -0,0 +1,39 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect One {
+ public static void main(String[] args) {
+
+ }
+
+ before(): call(* println(..)) {}
+
+ // ... that does something ...
+ public synchronized void b() {
+ System.out.println("hello");
+ }
+
+ // ... that includes try/catch ...
+ public synchronized void c() {
+ try {
+ File f = new File("fred");
+ FileInputStream fis = new FileInputStream(f);
+ } catch (IOException ioe) {
+ System.out.println("bang");
+ }
+ }
+
+ // ... with nested synchronized blocks ...
+ public synchronized void e() {
+ System.out.println("hello");
+ synchronized (new String()) {
+ System.out.println("other");
+ }
+ }
+
+}
+
+aspect OneX {
+ pointcut p(): lock();
+}
diff --git a/tests/features152/synchronization/transformed/OtherTargeters.java b/tests/features152/synchronization/transformed/OtherTargeters.java
new file mode 100644
index 000000000..e88a95f74
--- /dev/null
+++ b/tests/features152/synchronization/transformed/OtherTargeters.java
@@ -0,0 +1,25 @@
+public class OtherTargeters {
+ public static void main(String[] args) {
+ new OtherTargeters().foo();
+ }
+
+ // This method will have branch instructions that target a return which must be
+ // adjusted to target the monitor exit block
+ public synchronized void foo() {
+ int i = 35;
+ if (i==35) {
+ System.err.println("foo() running");
+ }
+ }
+
+ public void goo() {
+ int i = 35;
+ if (i==35) {
+ System.err.println("goo() running");
+ }
+ }
+}
+
+aspect X {
+ before(): execution(* foo(..)) {System.err.println("advice running");}
+} \ No newline at end of file
diff --git a/tests/features152/synchronization/transformed/Seven.java b/tests/features152/synchronization/transformed/Seven.java
new file mode 100644
index 000000000..6e786be63
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Seven.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching lock in a transformed non-static method...
+
+public aspect Seven {
+ public static void main(String[] args) {
+ new C().b();
+ }
+
+ before(): !within(Seven) && lock() {
+ System.err.println("Locking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/Six.java b/tests/features152/synchronization/transformed/Six.java
new file mode 100644
index 000000000..71c800a4b
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Six.java
@@ -0,0 +1,26 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect Six {
+ public static void main(String[] args) {
+ C.bbb();
+ C.c();
+ }
+
+ before(): !within(Six) && call(* println(..)) { System.err.println("test");}
+}
+
+class C {
+ public static synchronized void bbb() {
+ System.err.println("hello");
+ }
+
+ public static void c() {
+ synchronized (C.class) {
+ System.err.println("hello");
+ }
+ }
+}
+
+aspect SixX { pointcut p(): unlock(); }
diff --git a/tests/features152/synchronization/transformed/Ten.java b/tests/features152/synchronization/transformed/Ten.java
new file mode 100644
index 000000000..9a7b54105
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Ten.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching unlock on transformed static method (J5)
+
+public aspect Ten {
+ public static void main(String[] args) {
+ C.b();
+ }
+
+ before(): !within(Ten) && unlock() {
+ System.err.println("Unlocking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public static synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/Thirteen.java b/tests/features152/synchronization/transformed/Thirteen.java
new file mode 100644
index 000000000..82c71d0c6
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Thirteen.java
@@ -0,0 +1,6 @@
+interface I {
+
+ synchronized void foo();
+}
+public class Thirteen {
+}
diff --git a/tests/features152/synchronization/transformed/Three.java b/tests/features152/synchronization/transformed/Three.java
new file mode 100644
index 000000000..6a99c2e11
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Three.java
@@ -0,0 +1,44 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect Three {
+ public static void main(String[] args) {
+ new C().m3();
+ try {new C().m32(); } catch (MyException me) {int i=1;}
+ new C().m33();
+ try {new C().m34(); } catch (MyException me) {int i=1;}
+ }
+ after() returning: execution(* m3(..)) { System.err.println("execution advice running1");}
+ after() throwing: execution(* m32(..)) { System.err.println("execution advice running2");}
+ after() returning: execution(* m33(..)) { System.err.println("execution advice running3");}
+ after() throwing: execution(* m34(..)) { System.err.println("execution advice running4");}
+}
+
+class C {
+
+ public synchronized void m3() {
+ System.err.println("hello");
+ }
+
+ public synchronized void m32() {
+ System.err.println("hello");
+ throw new MyException();
+ }
+
+ public void m33() {
+ synchronized (this) {
+ System.err.println("hello");
+ }
+ }
+
+ public void m34() {
+ synchronized (this) {
+ System.err.println("hello");
+ throw new MyException();
+ }
+ }
+}
+ class MyException extends RuntimeException { }
+
+class ThreeX { pointcut p(): lock(); }
diff --git a/tests/features152/synchronization/transformed/Twelve.java b/tests/features152/synchronization/transformed/Twelve.java
new file mode 100644
index 000000000..f0016b5ef
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Twelve.java
@@ -0,0 +1,22 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+// matching unlock on transformed static method ( pre J5)
+
+public aspect Twelve {
+ public static void main(String[] args) {
+ C.b();
+ }
+
+ before(): !within(Twelve) && unlock() {
+ System.err.println("Unlocking occurring at "+thisJoinPoint);
+ System.err.println(thisJoinPoint.getSourceLocation().getFileName());
+ }
+}
+
+class C {
+ public static synchronized void b() {
+ System.err.println("hello");
+ }
+}
diff --git a/tests/features152/synchronization/transformed/Two.java b/tests/features152/synchronization/transformed/Two.java
new file mode 100644
index 000000000..129222cd3
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Two.java
@@ -0,0 +1,19 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public aspect Two {
+ public static void main(String[] args) {
+ new C().ma();
+ }
+ before(): execution(* ma(..)) { System.err.println("execution advice running");}
+}
+
+class C {
+
+ public synchronized void ma() {
+ System.err.println("hello");
+ }
+}
+
+aspect TwoX { pointcut p(): lock(); }
diff --git a/tests/features152/synchronization/transformed/expected/C.b.txt b/tests/features152/synchronization/transformed/expected/C.b.txt
new file mode 100644
index 000000000..15f85674d
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.b.txt
@@ -0,0 +1,22 @@
+ public static void b() org.aspectj.weaver.MethodDeclarationLineNumber: 17:340
+:
+ LDC C
+ DUP
+ ASTORE_0
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 18)
+ | LDC "hello"
+ | INVOKESTATIC Five.aspectOf ()LFive;
+ | INVOKEVIRTUAL Five.ajc$before$Five$1$af123de3 ()V
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_0
+ | MONITOREXIT
+ | RETURN (line 19)
+ finally -> E1
+ finally -> E1
+ | E1: ALOAD_0
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ end public static void b()
diff --git a/tests/features152/synchronization/transformed/expected/C.bbb.txt b/tests/features152/synchronization/transformed/expected/C.bbb.txt
new file mode 100644
index 000000000..b9f54d8eb
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.bbb.txt
@@ -0,0 +1,38 @@
+ public static void bbb() org.aspectj.weaver.MethodDeclarationLineNumber: 15:316
+:
+ GETSTATIC C.class$1 Ljava/lang/Class;
+ DUP
+ IFNONNULL L0
+ POP
+ catch java.lang.ClassNotFoundException -> E0
+ | LDC "C"
+ | INVOKESTATIC java.lang.Class.forName (Ljava/lang/String;)Ljava/lang/Class;
+ catch java.lang.ClassNotFoundException -> E0
+ DUP
+ PUTSTATIC C.class$1 Ljava/lang/Class;
+ GOTO L0
+ E0: NEW java.lang.NoClassDefFoundError
+ DUP_X1
+ SWAP
+ INVOKEVIRTUAL java.lang.Throwable.getMessage ()Ljava/lang/String;
+ INVOKESPECIAL java.lang.NoClassDefFoundError.<init> (Ljava/lang/String;)V
+ ATHROW
+ L0: DUP
+ ASTORE_0
+ MONITORENTER
+ finally -> E2
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 16)
+ | LDC "hello"
+ | INVOKESTATIC Six.aspectOf ()LSix;
+ | INVOKEVIRTUAL Six.ajc$before$Six$1$cb48297b ()V
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_0
+ | MONITOREXIT
+ | RETURN (line 17)
+ finally -> E2
+ finally -> E2
+ | E2: ALOAD_0
+ | MONITOREXIT
+ finally -> E2
+ ATHROW
+ end public static void bbb()
diff --git a/tests/features152/synchronization/transformed/expected/C.m.txt b/tests/features152/synchronization/transformed/expected/C.m.txt
new file mode 100644
index 000000000..7f5a34cdc
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m.txt
@@ -0,0 +1,23 @@
+ public void m() org.aspectj.weaver.MethodDeclarationLineNumber: 16:496
+:
+ ALOAD_0
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 17)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1
+ | MONITOREXIT
+ | GOTO L0 (line 18)
+ finally -> E1
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ L0: INVOKESTATIC Four.aspectOf ()LFour;
+ INVOKEVIRTUAL Four.ajc$afterReturning$Four$1$c2776aed ()V
+ RETURN
+ end public void m()
diff --git a/tests/features152/synchronization/transformed/expected/C.m2.txt b/tests/features152/synchronization/transformed/expected/C.m2.txt
new file mode 100644
index 000000000..ab4a19919
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m2.txt
@@ -0,0 +1,28 @@
+ public void m2() org.aspectj.weaver.MethodDeclarationLineNumber: 20:571
+:
+ catch java.lang.Throwable -> E2
+ | ALOAD_0
+ | DUP
+ | ASTORE_1
+ | MONITORENTER
+ | finally -> E1
+ | | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 21)
+ | | LDC "hello"
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | NEW MyException (line 22)
+ | | DUP
+ | | INVOKESPECIAL MyException.<init> ()V
+ | | ATHROW
+ | finally -> E1
+ | finally -> E1
+ | | E1: ALOAD_1
+ | | MONITOREXIT
+ | finally -> E1
+ | ATHROW
+ catch java.lang.Throwable -> E2
+ E2: ASTORE_2
+ INVOKESTATIC Four.aspectOf ()LFour;
+ INVOKEVIRTUAL Four.ajc$afterThrowing$Four$2$9d31eed1 ()V
+ ALOAD_2
+ ATHROW
+ end public void m2()
diff --git a/tests/features152/synchronization/transformed/expected/C.m3.txt b/tests/features152/synchronization/transformed/expected/C.m3.txt
new file mode 100644
index 000000000..f1157285e
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m3.txt
@@ -0,0 +1,23 @@
+ public void m3() org.aspectj.weaver.MethodDeclarationLineNumber: 20:747
+:
+ ALOAD_0
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 21)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1
+ | MONITOREXIT
+ | GOTO L0 (line 22)
+ finally -> E1
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ L0: INVOKESTATIC Three.aspectOf ()LThree;
+ INVOKEVIRTUAL Three.ajc$afterReturning$Three$1$3f09355c ()V
+ RETURN
+ end public void m3()
diff --git a/tests/features152/synchronization/transformed/expected/C.m32.txt b/tests/features152/synchronization/transformed/expected/C.m32.txt
new file mode 100644
index 000000000..0e2819293
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m32.txt
@@ -0,0 +1,28 @@
+ public void m32() org.aspectj.weaver.MethodDeclarationLineNumber: 24:823
+:
+ catch java.lang.Throwable -> E2
+ | ALOAD_0
+ | DUP
+ | ASTORE_1
+ | MONITORENTER
+ | finally -> E1
+ | | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 25)
+ | | LDC "hello"
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | NEW MyException (line 26)
+ | | DUP
+ | | INVOKESPECIAL MyException.<init> ()V
+ | | ATHROW
+ | finally -> E1
+ | finally -> E1
+ | | E1: ALOAD_1
+ | | MONITOREXIT
+ | finally -> E1
+ | ATHROW
+ catch java.lang.Throwable -> E2
+ E2: ASTORE_2
+ INVOKESTATIC Three.aspectOf ()LThree;
+ INVOKEVIRTUAL Three.ajc$afterThrowing$Three$2$b2d97242 ()V
+ ALOAD_2
+ ATHROW
+ end public void m32()
diff --git a/tests/features152/synchronization/transformed/expected/C.m33.txt b/tests/features152/synchronization/transformed/expected/C.m33.txt
new file mode 100644
index 000000000..86b78ffb3
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m33.txt
@@ -0,0 +1,24 @@
+ public void m33() org.aspectj.weaver.MethodDeclarationLineNumber: 29:917
+:
+ ALOAD_0 // LC; this (line 30)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 31)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1 (line 30)
+ | MONITOREXIT
+ finally -> E1
+ GOTO L0
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ L0: GOTO L1 (line 33)
+ L1: INVOKESTATIC Three.aspectOf ()LThree;
+ INVOKEVIRTUAL Three.ajc$afterReturning$Three$3$b48e4ae1 ()V
+ RETURN
+ end public void m33()
diff --git a/tests/features152/synchronization/transformed/expected/C.m34.txt b/tests/features152/synchronization/transformed/expected/C.m34.txt
new file mode 100644
index 000000000..c787ba249
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m34.txt
@@ -0,0 +1,26 @@
+ public void m34() org.aspectj.weaver.MethodDeclarationLineNumber: 35:1018
+:
+ catch java.lang.Throwable -> E1
+ | ALOAD_0 // LC; this (line 36)
+ | DUP
+ | ASTORE_1
+ | MONITORENTER
+ | finally -> E0
+ | | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 37)
+ | | LDC "hello"
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | NEW MyException (line 38)
+ | | DUP
+ | | INVOKESPECIAL MyException.<init> ()V
+ | | ATHROW
+ | | E0: ALOAD_1 (line 36)
+ | | MONITOREXIT
+ | finally -> E0
+ | ATHROW
+ catch java.lang.Throwable -> E1
+ E1: ASTORE_2
+ INVOKESTATIC Three.aspectOf ()LThree;
+ INVOKEVIRTUAL Three.ajc$afterThrowing$Three$4$b6432380 ()V
+ ALOAD_2
+ ATHROW
+ end public void m34()
diff --git a/tests/features152/synchronization/transformed/expected/C.m4.txt b/tests/features152/synchronization/transformed/expected/C.m4.txt
new file mode 100644
index 000000000..9e50085ea
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.m4.txt
@@ -0,0 +1,26 @@
+ public void m4() org.aspectj.weaver.MethodDeclarationLineNumber: 35:1007
+:
+ catch java.lang.Throwable -> E1
+ | ALOAD_0 // LC; this (line 36)
+ | DUP
+ | ASTORE_1
+ | MONITORENTER
+ | finally -> E0
+ | | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 37)
+ | | LDC "hello"
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | NEW MyException (line 38)
+ | | DUP
+ | | INVOKESPECIAL MyException.<init> ()V
+ | | ATHROW
+ | | E0: ALOAD_1 (line 36)
+ | | MONITOREXIT
+ | finally -> E0
+ | ATHROW
+ catch java.lang.Throwable -> E1
+ E1: ASTORE_2
+ INVOKESTATIC Three.aspectOf ()LThree;
+ INVOKEVIRTUAL Three.ajc$afterThrowing$Three$4$40be0dfb ()V
+ ALOAD_2
+ ATHROW
+ end public void m4()
diff --git a/tests/features152/synchronization/transformed/expected/C.ma.txt b/tests/features152/synchronization/transformed/expected/C.ma.txt
new file mode 100644
index 000000000..0a6b97849
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/C.ma.txt
@@ -0,0 +1,22 @@
+ public void ma() org.aspectj.weaver.MethodDeclarationLineNumber: 14:307
+:
+ INVOKESTATIC Two.aspectOf ()LTwo;
+ INVOKEVIRTUAL Two.ajc$before$Two$1$8d8821ee ()V
+ ALOAD_0
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.err Ljava/io/PrintStream; (line 15)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1
+ | MONITOREXIT
+ | RETURN (line 16)
+ finally -> E1
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ end public void ma()
diff --git a/tests/features152/synchronization/transformed/expected/Investigation.b.txt b/tests/features152/synchronization/transformed/expected/Investigation.b.txt
new file mode 100644
index 000000000..15f83a1d6
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/Investigation.b.txt
@@ -0,0 +1,21 @@
+ public void b() org.aspectj.weaver.MethodDeclarationLineNumber: 19:312
+:
+ ALOAD_0 // LInvestigation; this (line 20)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 21)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1 (line 20)
+ | MONITOREXIT
+ finally -> E1
+ GOTO L0
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ L0: RETURN (line 23)
+ end public void b()
diff --git a/tests/features152/synchronization/transformed/expected/Investigation.c.txt b/tests/features152/synchronization/transformed/expected/Investigation.c.txt
new file mode 100644
index 000000000..7fa235d5d
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/Investigation.c.txt
@@ -0,0 +1,35 @@
+ public void c() org.aspectj.weaver.MethodDeclarationLineNumber: 26:439
+:
+ ALOAD_0 // LInvestigation; this (line 27)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E2
+ | catch java.io.IOException -> E0
+ | | NEW java.io.File (line 29)
+ | | DUP
+ | | LDC "fred"
+ | | INVOKESPECIAL java.io.File.<init> (Ljava/lang/String;)V
+ | | ASTORE_2
+ | | NEW java.io.FileInputStream (line 30)
+ | | DUP
+ | | ALOAD_2 // Ljava/io/File; f
+ | | INVOKESPECIAL java.io.FileInputStream.<init> (Ljava/io/File;)V
+ | | POP
+ | | GOTO L0
+ | catch java.io.IOException -> E0
+ | E0: POP (line 31)
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 32)
+ | LDC "bang"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | L0: ALOAD_1 (line 27)
+ | MONITOREXIT
+ finally -> E2
+ GOTO L1
+ finally -> E2
+ | E2: ALOAD_1
+ | MONITOREXIT
+ finally -> E2
+ ATHROW
+ L1: RETURN (line 35)
+ end public void c()
diff --git a/tests/features152/synchronization/transformed/expected/Investigation.d.txt b/tests/features152/synchronization/transformed/expected/Investigation.d.txt
new file mode 100644
index 000000000..a2a73c36a
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/Investigation.d.txt
@@ -0,0 +1,38 @@
+ public void d() org.aspectj.weaver.MethodDeclarationLineNumber: 38:706
+:
+ ALOAD_0 // LInvestigation; this (line 39)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 40)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1 (line 39)
+ | MONITOREXIT
+ finally -> E1
+ GOTO L0
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ L0: ALOAD_0 // LInvestigation; this (line 42)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E3
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 43)
+ | LDC "world"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1 (line 42)
+ | MONITOREXIT
+ finally -> E3
+ GOTO L1
+ finally -> E3
+ | E3: ALOAD_1
+ | MONITOREXIT
+ finally -> E3
+ ATHROW
+ L1: RETURN (line 45)
+ end public void d()
diff --git a/tests/features152/synchronization/transformed/expected/Investigation.e.txt b/tests/features152/synchronization/transformed/expected/Investigation.e.txt
new file mode 100644
index 000000000..6508daf3a
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/Investigation.e.txt
@@ -0,0 +1,40 @@
+ public void e() org.aspectj.weaver.MethodDeclarationLineNumber: 48:904
+:
+ ALOAD_0 // LInvestigation; this (line 49)
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E3
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 50)
+ | LDC "hello"
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | NEW java.lang.String (line 51)
+ | DUP
+ | INVOKESPECIAL java.lang.String.<init> ()V
+ | DUP
+ | ASTORE_2
+ | MONITORENTER
+ | finally -> E1
+ | | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 52)
+ | | LDC "other"
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | ALOAD_2 (line 51)
+ | | MONITOREXIT
+ | finally -> E1
+ | GOTO L0
+ | finally -> E1
+ | | E1: ALOAD_2
+ | | MONITOREXIT
+ | finally -> E1
+ | ATHROW
+ | L0: ALOAD_1 (line 49)
+ | MONITOREXIT
+ finally -> E3
+ GOTO L1
+ finally -> E3
+ | E3: ALOAD_1
+ | MONITOREXIT
+ finally -> E3
+ ATHROW
+ L1: RETURN (line 55)
+ end public void e()
diff --git a/tests/features152/synchronization/transformed/expected/One.b.txt b/tests/features152/synchronization/transformed/expected/One.b.txt
new file mode 100644
index 000000000..948cb66cd
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/One.b.txt
@@ -0,0 +1,22 @@
+ public void b() org.aspectj.weaver.MethodDeclarationLineNumber: 13:259
+:
+ ALOAD_0
+ DUP
+ ASTORE_1
+ MONITORENTER
+ finally -> E1
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 14)
+ | LDC "hello"
+ | INVOKESTATIC One.aspectOf ()LOne;
+ | INVOKEVIRTUAL One.ajc$before$One$1$d2a8f7b9 ()V
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | ALOAD_1
+ | MONITOREXIT
+ | RETURN (line 15)
+ finally -> E1
+ finally -> E1
+ | E1: ALOAD_1
+ | MONITOREXIT
+ finally -> E1
+ ATHROW
+ end public void b()
diff --git a/tests/features152/synchronization/transformed/expected/One.c.txt b/tests/features152/synchronization/transformed/expected/One.c.txt
new file mode 100644
index 000000000..3641c9b36
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/One.c.txt
@@ -0,0 +1,36 @@
+ public void c() org.aspectj.weaver.MethodDeclarationLineNumber: 18:368
+:
+ ALOAD_0
+ DUP
+ ASTORE_2
+ MONITORENTER
+ finally -> E2
+ | catch java.io.IOException -> E0
+ | | NEW java.io.File (line 20)
+ | | DUP
+ | | LDC "fred"
+ | | INVOKESPECIAL java.io.File.<init> (Ljava/lang/String;)V
+ | | ASTORE_1
+ | | NEW java.io.FileInputStream (line 21)
+ | | DUP
+ | | ALOAD_1 // Ljava/io/File; f
+ | | INVOKESPECIAL java.io.FileInputStream.<init> (Ljava/io/File;)V
+ | | POP
+ | | GOTO L0
+ | catch java.io.IOException -> E0
+ | E0: POP (line 22)
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 23)
+ | LDC "bang"
+ | INVOKESTATIC One.aspectOf ()LOne;
+ | INVOKEVIRTUAL One.ajc$before$One$1$d2a8f7b9 ()V
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | L0: ALOAD_2
+ | MONITOREXIT
+ | RETURN (line 25)
+ finally -> E2
+ finally -> E2
+ | E2: ALOAD_2
+ | MONITOREXIT
+ finally -> E2
+ ATHROW
+ end public void c()
diff --git a/tests/features152/synchronization/transformed/expected/One.e.txt b/tests/features152/synchronization/transformed/expected/One.e.txt
new file mode 100644
index 000000000..85d93f0ed
--- /dev/null
+++ b/tests/features152/synchronization/transformed/expected/One.e.txt
@@ -0,0 +1,43 @@
+ public void e() org.aspectj.weaver.MethodDeclarationLineNumber: 28:611
+:
+ ALOAD_0
+ DUP
+ ASTORE_2
+ MONITORENTER
+ finally -> E3
+ | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 29)
+ | LDC "hello"
+ | INVOKESTATIC One.aspectOf ()LOne;
+ | INVOKEVIRTUAL One.ajc$before$One$1$d2a8f7b9 ()V
+ | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | NEW java.lang.String (line 30)
+ | DUP
+ | INVOKESPECIAL java.lang.String.<init> ()V
+ | DUP
+ | ASTORE_1
+ | MONITORENTER
+ | finally -> E1
+ | | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 31)
+ | | LDC "other"
+ | | INVOKESTATIC One.aspectOf ()LOne;
+ | | INVOKEVIRTUAL One.ajc$before$One$1$d2a8f7b9 ()V
+ | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
+ | | ALOAD_1 (line 30)
+ | | MONITOREXIT
+ | finally -> E1
+ | GOTO L0
+ | finally -> E1
+ | | E1: ALOAD_1
+ | | MONITOREXIT
+ | finally -> E1
+ | ATHROW
+ | L0: ALOAD_2
+ | MONITOREXIT
+ | RETURN (line 33)
+ finally -> E3
+ finally -> E3
+ | E3: ALOAD_2
+ | MONITOREXIT
+ finally -> E3
+ ATHROW
+ end public void e()