This is an automated email from the ASF dual-hosted git repository.
damondouglas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new b6108465589 Remove SuppressWarnings from NoopLock.java (#27416)
b6108465589 is described below
commit b6108465589a84a1fbce001a87d3760d1a3f82f5
Author: Damon <[email protected]>
AuthorDate: Thu Jul 20 15:04:32 2023 -0700
Remove SuppressWarnings from NoopLock.java (#27416)
* Remove SuppressWarnings from NoopLock.java
* Remove Nonnull annotations from original
---
.../src/main/java/org/apache/beam/sdk/util/NoopLock.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git
a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java
index 0fc822987a6..36454a125d6 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java
@@ -21,21 +21,19 @@ import java.io.Serializable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
-import javax.annotation.Nonnull;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A lock which can always be acquired. It should not be used when a proper
lock is required, but it
* is useful as a performance optimization when locking is not necessary but
the code paths have to
* be shared between the locking and the non-locking variant.
*/
-@SuppressWarnings({
- "nullness" // TODO(https://github.com/apache/beam/issues/20497)
-})
public class NoopLock implements Lock, Serializable {
- private static NoopLock instance;
+ private static @MonotonicNonNull NoopLock instance;
- public static NoopLock get() {
+ public static @NonNull NoopLock get() {
if (instance == null) {
instance = new NoopLock();
}
@@ -56,14 +54,13 @@ public class NoopLock implements Lock, Serializable {
}
@Override
- public boolean tryLock(long time, @Nonnull TimeUnit unit) {
+ public boolean tryLock(long time, TimeUnit unit) {
return true;
}
@Override
public void unlock() {}
- @Nonnull
@Override
public Condition newCondition() {
throw new UnsupportedOperationException("Not implemented");