This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git

commit 05c9ed0563949626a14f72252b887dfa85fa9701
Author: Mridul Muralidharan <[email protected]>
AuthorDate: Sun Oct 22 22:36:31 2023 +0800

    [CELEBORN-1069] Avoid double brace initialization
    
    Avoid double brace initialization. See more 
[here](https://errorprone.info/bugpattern/DoubleBraceInitialization)
    Note that in this case, there is no actual functional or performance issue 
- since it is happening in test cases.
    
    Once fixed, error-prone can catch future violations as part of build as 
Celeborn evolves.
    
    No
    
    Unit tests
    
    Closes #2020 from mridulm/avoid-double-brace-initialization.
    
    Authored-by: Mridul Muralidharan <mridulatgmail.com>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 .../deploy/master/clustermeta/DefaultMetaSystemSuiteJ.java     |  8 ++------
 .../master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java   | 10 +++-------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git 
a/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/DefaultMetaSystemSuiteJ.java
 
b/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/DefaultMetaSystemSuiteJ.java
index 2962ebafd..bb845b192 100644
--- 
a/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/DefaultMetaSystemSuiteJ.java
+++ 
b/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/DefaultMetaSystemSuiteJ.java
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.when;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicLong;
 
+import com.google.common.collect.ImmutableMap;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -309,12 +310,7 @@ public class DefaultMetaSystemSuiteJ {
         HOSTNAME1 + ":" + RPCPORT1 + ":" + PUSHPORT1 + ":" + FETCHPORT1 + ":" 
+ REPLICATEPORT1);
 
     List<Map<String, Integer>> workerSlots = new ArrayList<>();
-    workerSlots.add(
-        new HashMap() {
-          {
-            put("disk1", 3);
-          }
-        });
+    workerSlots.add(ImmutableMap.of("disk1", 3));
 
     Assert.assertEquals(
         0,
diff --git 
a/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java
 
b/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java
index b8cdae002..84d383cf7 100644
--- 
a/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java
+++ 
b/master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicLong;
 
+import com.google.common.collect.ImmutableMap;
 import org.junit.*;
 import org.mockito.Mockito;
 
@@ -167,7 +168,7 @@ public class RatisMasterStatusSystemSuiteJ {
   private static int PUSHPORT1 = 1112;
   private static int FETCHPORT1 = 1113;
   private static int REPLICATEPORT1 = 1114;
-  private static Map<String, DiskInfo> disks1 = new HashMap() {};
+  private static Map<String, DiskInfo> disks1 = new HashMap();
   private static Map<UserIdentifier, ResourceConsumption> 
userResourceConsumption1 =
       new HashMap<>();
 
@@ -487,12 +488,7 @@ public class RatisMasterStatusSystemSuiteJ {
         HOSTNAME1 + ":" + RPCPORT1 + ":" + PUSHPORT1 + ":" + FETCHPORT1 + ":" 
+ REPLICATEPORT1);
 
     List<Map<String, Integer>> workerSlots = new ArrayList<>();
-    workerSlots.add(
-        new HashMap() {
-          {
-            put("disk1", 3);
-          }
-        });
+    workerSlots.add(ImmutableMap.of("disk1", 3));
 
     Thread.sleep(3000L);
 

Reply via email to