szetszwo commented on code in PR #951:
URL: https://github.com/apache/ratis/pull/951#discussion_r1370583619


##########
ratis-common/src/main/java/org/apache/ratis/util/AutoCloseableLock.java:
##########
@@ -39,6 +39,7 @@ public static AutoCloseableLock acquire(final Lock lock) {
     return acquire(lock, null);
   }
 
+  @SuppressWarnings("java:S2222")

Review Comment:
   Please add a comment:
   ```java
   @SuppressWarnings("java:S2222") // Locks should be released 
   ```



##########
ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java:
##########
@@ -133,6 +133,7 @@ void set(Collection<RaftPeer> newPeers) {
   private final RaftGroupId groupId;
   private final RetryPolicy retryPolicy;
 
+  @SuppressWarnings("java:S3077")

Review Comment:
   It seem that we may use @Immutable to avoid it according to 
https://community.sonarsource.com/t/rule-s3077-frequently-generates-a-false-positive/27479/14
   ```java
   +++ b/ratis-common/src/main/java/org/apache/ratis/protocol/RaftPeerId.java
   @@ -22,6 +22,7 @@ import 
org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
    import org.apache.ratis.util.JavaUtils;
    import org.apache.ratis.util.Preconditions;
    
   +import javax.annotation.concurrent.Immutable;
    import java.nio.charset.StandardCharsets;
    import java.util.Map;
    import java.util.Objects;
   @@ -33,6 +34,7 @@ import java.util.function.Supplier;
     * <p>
     * This is a value-based class.
     */
   +@Immutable
    public final class RaftPeerId {
   ```



-- 
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