Fix deprecated newInstance in ClusterCommandConfigBuilder.java

src/com/android/tradefed/cluster/ClusterCommandConfigBuilder.java

Test: make
Test: UnitTests (local)

Bug: 145625254
Change-Id: I298e20442b90ac9a82335f3ee6c792dc77d54892
diff --git a/src/com/android/tradefed/cluster/ClusterCommandConfigBuilder.java b/src/com/android/tradefed/cluster/ClusterCommandConfigBuilder.java
index 8669f0b..c450a11 100644
--- a/src/com/android/tradefed/cluster/ClusterCommandConfigBuilder.java
+++ b/src/com/android/tradefed/cluster/ClusterCommandConfigBuilder.java
@@ -29,6 +29,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -120,8 +121,15 @@
             throws ConfigurationException {
         Object configObj = null;
         try {
-            configObj = Class.forName(configObjDef.getClassName()).newInstance();
-        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+            configObj =
+                    Class.forName(configObjDef.getClassName())
+                            .getDeclaredConstructor()
+                            .newInstance();
+        } catch (InstantiationException
+                | IllegalAccessException
+                | ClassNotFoundException
+                | InvocationTargetException
+                | NoSuchMethodException e) {
             throw new ConfigurationException(
                     String.format(
                             "Failed to add a config object '%s'", configObjDef.getClassName()),