aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features152/synchronization/transformed/Program.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features152/synchronization/transformed/Program.java')
-rw-r--r--tests/features152/synchronization/transformed/Program.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/features152/synchronization/transformed/Program.java b/tests/features152/synchronization/transformed/Program.java
new file mode 100644
index 000000000..2d92cfa81
--- /dev/null
+++ b/tests/features152/synchronization/transformed/Program.java
@@ -0,0 +1,35 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public class Program {
+ public static void main(String[] args) {
+ new Program().b();
+ new Program().c();
+ new Program().d();
+ }
+
+ // ... that does something ...
+ public synchronized void b() {
+ System.out.println("hello from b()");
+ }
+
+ // ... 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 in c()");
+ }
+ }
+
+ // ... with nested synchronized blocks ...
+ public synchronized void d() {
+ System.out.println("hello from d()");
+ synchronized (new String()) {
+ System.out.println("hello from block in d()");
+ }
+ }
+
+}