import java.util.concurrent.locks.*;

class JSR166 {
	Lock l = new ReentrantLock();
	ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock();

	int x;

	void l() {
		l.lock();
	}

	void foo() {
		l.lock();
		x++;
		if (x >= 0)
			l.unlock();
	}
	
	ReadWriteLock rwLock =  new ReentrantReadWriteLock();
	
	int counter;
	int readWriteLockTestReadLock() {
		rwLock.readLock().lock();
		try {
		return counter;
		} finally {
			rwLock.readLock().unlock();
		}
		
		
	}

	int readWriteLockTestWriteLock() {
		rwLock.writeLock().lock();
		try {
		return counter++;
		} finally {
			rwLock.writeLock().unlock();
		}
		
		
	}
	void increment() {
		l.lock();
		x++;
		l.unlock();
	}

	void decrement() {
		l.lock();
		try {
			x++;
		} finally {
			l.unlock();
		}
	}

	Object bug1479629() {
		try {
			rwlock.readLock().lock();
			return null;
		} finally {
			rwlock.readLock().unlock();
		}
	}

	Object bug1479629w() {
		try {
			rwlock.writeLock().lock();
			return null;
		} finally {
			rwlock.writeLock().unlock();
		}
	}

	Object bug1479629a(ReadWriteLock lock) {
		try {
			lock.readLock().lock();
			return null;
		} finally {
			lock.readLock().unlock();
		}
	}
	Object bug1479629aw(ReadWriteLock lock) {
		try {
			lock.writeLock().lock();
			return null;
		} finally {
			lock.writeLock().unlock();
		}
	}
	void waitOnCondition(Condition cond) throws InterruptedException {
		while (x == 0) {
			cond.wait();
			cond.wait(1000L);
			cond.wait(1000L, 10);
		}
	}

	void awaitNotInLoop(Condition cond) throws InterruptedException {
		cond.await();
	}
}

@@ -777,33 +777,24 @@
 1479629() %7B%0A
-%09%09try %7B%0A%09
 %09%09rwlock.rea
@@ -801,32 +801,41 @@
 dLock().lock();%0A
+%09%09try %7B%0A%0A
 %09%09%09return null;%0A
@@ -911,25 +911,16 @@
 29w() %7B%0A
-%09%09try %7B%0A%09
 %09%09rwlock
@@ -932,32 +932,41 @@
 eLock().lock();%0A
+%09%09try %7B%0A%0A
 %09%09%09return null;%0A
@@ -1057,33 +1057,24 @@
 ock lock) %7B%0A
-%09%09try %7B%0A%09
 %09%09lock.readL
@@ -1079,32 +1079,41 @@
 dLock().lock();%0A
+%09%09try %7B%0A%0A
 %09%09%09return null;%0A
@@ -1205,25 +1205,16 @@
 lock) %7B%0A
-%09%09try %7B%0A%09
 %09%09lock.w
@@ -1232,16 +1232,25 @@
 lock();%0A
+%09%09try %7B%0A%0A
 %09%09%09retur
@@ -1551,10 +1551,352 @@
 t();%0A%09%7D%0A
+%09%0A%09final Lock fieldLock = new ReentrantLock();%0A%09%0A%09int y;%0A%09int lockOnFieldDoNotReport(Object f) %7B%0A%09%09fieldLock.lock();%0A%09%09try %7B%0A%09%09%09y += f.hashCode();%0A%09%09%09return y;%0A%09%09%7D finally %7B%0A%09%09%09fieldLock.unlock();%0A%09%09%7D%0A%09%7D%0A%09int lockOnFieldReport(Object f) %7B%0A%09%09fieldLock.lock();%0A%09%09y += f.hashCode();%0A%09%09int result = y;%0A%09%09fieldLock.unlock();%0A%09%09return result;%0A%09%7D%0A%09%0A
 %7D%0A

Add test case for locking on a field