Add tests for Locked annotations

This commit is contained in:
Pim van der Loos committed 2023-04-18 18:07:53 +02:00
1 parent 5e31bb253c
commit cb25fce7aa
25 files changed
+634

No files matched your search

@@ -0,0 +1,31 @@
class LockedName {
@java.lang.SuppressWarnings("all")
private final java.util.concurrent.locks.ReentrantLock basicLock = new java.util.concurrent.locks.ReentrantLock();
@java.lang.SuppressWarnings("all")
private final java.util.concurrent.locks.ReentrantReadWriteLock rwLock = new java.util.concurrent.locks.ReentrantReadWriteLock();
void test() {
this.basicLock.lock();
try {
System.out.println("one");
} finally {
this.basicLock.unlock();
}
}
void test2() {
this.rwLock.readLock().lock();
try {
System.out.println("two");
} finally {
this.rwLock.readLock().unlock();
}
}
void test3() {
this.rwLock.writeLock().lock();
try {
System.out.println("three");
} finally {
this.rwLock.writeLock().unlock();
}
}
}