damondouglas commented on code in PR #27416:
URL: https://github.com/apache/beam/pull/27416#discussion_r1264741580


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java:
##########
@@ -21,21 +21,19 @@
 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() {

Review Comment:
   The `@NonNull` annotation seemed appropriate here given that the returned 
instance, if null, will always be instantiated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to