protected static <T> String versionFor(T pluginImpl) {
        try {
            if (pluginImpl instanceof Versioned) {
                return ((Versioned) pluginImpl).version();
            }
        } catch (Throwable t) {
            log.error("Failed to get plugin version for " + pluginImpl.getClass(), t);
        }
        return PluginDesc.UNDEFINED_VERSION;
    }
Helper to evaluate a {@link ServiceLoader} operation while handling {@link LinkageError}s.

@param type The plugin type which is being loaded
@param function A function on a {@link ServiceLoader}'s {@link Iterator} which may throw {@link LinkageError}
@return the return value of function
@throws Error errors thrown by the passed-in function
@param <U> Return value of the passed-in function
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java