From 9fca87d67736a62f95f9d9dab95db1c3e3343c54 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 24 Oct 2022 15:40:16 +0200 Subject: [PATCH] Removed nullpointer --- .../concurrent/locks/DummyReadWriteLock.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboon/jpp/util/concurrent/locks/DummyReadWriteLock.java b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboon/jpp/util/concurrent/locks/DummyReadWriteLock.java index c0fa90f0..788ea502 100644 --- a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboon/jpp/util/concurrent/locks/DummyReadWriteLock.java +++ b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboon/jpp/util/concurrent/locks/DummyReadWriteLock.java @@ -1,5 +1,6 @@ package love.distributedrebirth.bassboon.jpp.util.concurrent.locks; +import java.util.Date; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; @@ -14,6 +15,7 @@ public final class DummyReadWriteLock implements ReadWriteLock { private final static Lock LOCK_READ = new DummyLock(); private final static Lock LOCK_WRITE = new DummyLock(); + private final static DummyCondition LOCK_CONDITION = new DummyCondition(); @Override public Lock readLock() { @@ -25,6 +27,40 @@ public final class DummyReadWriteLock implements ReadWriteLock { return LOCK_WRITE; } + static final class DummyCondition implements Condition { + + @Override + public void await() throws InterruptedException { + } + + @Override + public boolean await(long arg0, TimeUnit arg1) throws InterruptedException { + return false; + } + + @Override + public long awaitNanos(long nanosTimeout) throws InterruptedException { + return 0; + } + + @Override + public void awaitUninterruptibly() { + } + + @Override + public boolean awaitUntil(Date deadline) throws InterruptedException { + return false; + } + + @Override + public void signal() { + } + + @Override + public void signalAll() { + } + } + static final class DummyLock implements Lock { @Override @@ -37,7 +73,7 @@ public final class DummyReadWriteLock implements ReadWriteLock { @Override public Condition newCondition() { - return null; + return LOCK_CONDITION; } @Override