alexeykudinkin commented on code in PR #5378:
URL: https://github.com/apache/hudi/pull/5378#discussion_r854785088


##########
hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java:
##########
@@ -85,11 +87,14 @@ public static <T extends HoodieRecordPayload> T 
loadPayload(String recordPayload
    * Creates an instance of the given class. Use this version when dealing 
with interface types as constructor args.
    */
   public static Object loadClass(String clazz, Class<?>[] constructorArgTypes, 
Object... constructorArgs) {
-    try {
-      return 
getClass(clazz).getConstructor(constructorArgTypes).newInstance(constructorArgs);
-    } catch (InstantiationException | IllegalAccessException | 
InvocationTargetException | NoSuchMethodException e) {
-      throw new HoodieException("Unable to instantiate class " + clazz, e);
-    }
+    return newInstanceUnchecked(getClass(clazz), constructorArgTypes, 
constructorArgs);
+  }
+
+  /**
+   * Creates an instance of the given class. Constructor arg types are 
inferred.
+   */
+  public static Object loadClass(String clazz, Object... constructorArgs) {
+    return newInstanceUnchecked(getClass(clazz), constructorArgs);

Review Comment:
   It's a fair point though that there's no reason to keep it in this PR, since 
it's not being used in it. 
   Removed from it.



##########
hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java:
##########
@@ -85,11 +87,14 @@ public static <T extends HoodieRecordPayload> T 
loadPayload(String recordPayload
    * Creates an instance of the given class. Use this version when dealing 
with interface types as constructor args.
    */
   public static Object loadClass(String clazz, Class<?>[] constructorArgTypes, 
Object... constructorArgs) {
-    try {
-      return 
getClass(clazz).getConstructor(constructorArgTypes).newInstance(constructorArgs);
-    } catch (InstantiationException | IllegalAccessException | 
InvocationTargetException | NoSuchMethodException e) {
-      throw new HoodieException("Unable to instantiate class " + clazz, e);
-    }
+    return newInstanceUnchecked(getClass(clazz), constructorArgTypes, 
constructorArgs);
+  }
+
+  /**
+   * Creates an instance of the given class. Constructor arg types are 
inferred.
+   */
+  public static Object loadClass(String clazz, Object... constructorArgs) {
+    return newInstanceUnchecked(getClass(clazz), constructorArgs);

Review Comment:
   It's a fair point though that there's no reason to keep it in this PR, since 
it's not being used in it. 
   Removed it.



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