aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features152/synchronization/transformed/Program.java
blob: 2d92cfa81560bed5e1db9661dc82e59d1bd8e134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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()");
		}
	}

}