XComp commented on code in PR #21387: URL: https://github.com/apache/flink/pull/21387#discussion_r1033404880
########## flink-runtime/src/main/java/org/apache/flink/runtime/metrics/ReporterSetup.java: ########## @@ -464,6 +466,21 @@ private static Optional<MetricReporter> loadViaReflection( alternativeFactoryClassName, reporterName, reporterConfig, reporterFactories); } - return Optional.of((MetricReporter) reporterClass.newInstance()); + try { + return Optional.of((MetricReporter) reporterClass.newInstance()); + } catch (InstantiationException e) { + if (ExceptionUtils.findThrowable(e, NoSuchMethodException.class).isPresent()) { + throw new IllegalConfigurationException( + String.format( + "%s does not implement a default constructor but is explicitly configured. " + + "Reflection-based instantiation of reporter instances is deprecated " + + "and does not necessarily work. Instead, factory-based instantiation " Review Comment: Fair enough. Initially, I preferred having this mentioned in the error message. But considering that the log warning is printed right before the stacktrace (which I wasn't considering initially when checking the Jira issue's related ML thread post), your proposal should be good enough. I updated the log message as suggested and force-pushed the change. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org