alexeykudinkin commented on code in PR #5378:
URL: https://github.com/apache/hudi/pull/5378#discussion_r854747053
##########
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 was used initially, but had to steer away b/c of Scala limitations (Scala
enums are problematic from the reflection standpoint).
This code is executed in every writing test, and it just moves
implementation from one method to another to expose a new method, i don't think
we need to worry about this one in particular.
--
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]