Source:
public LinkedHashSet<String> findJars(Class<?>[] defaultClasses) { List<Class<?>> jarClasses = new ArrayList<>(); for (String className : dag.getClassNames()) { try { Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className); jarClasses.add(clazz); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Failed to load class " + className, e); } } for (Class<?> clazz : Lists.newArrayList(jarClasses)) { for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) { jarClasses.add(c); jarClasses.addAll(Arrays.asList(c.getInterfaces())); } } jarClasses.addAll(Arrays.asList(defaultClasses)); if (dag.isDebug()) { LOG.debug("Deploy dependencies: {}", jarClasses); } LinkedHashSet<String> localJarFiles = new LinkedHashSet<>(); JarHelper jarHelper = new JarHelper(); for (Class<?> jarClass : jarClasses) { String jar = jarHelper.getJar(jarClass); if (jar != null) { localJarFiles.add(jar); } } String libJarsPath = dag.getValue(Context.DAGContext.LIBRARY_JARS); if (!StringUtils.isEmpty(libJarsPath)) { String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP); localJarFiles.addAll(Arrays.asList(libJars)); } String pluginClassesPaths = conf.get(StreamingAppMasterService.PLUGINS_CONF_KEY); if (!StringUtils.isEmpty(pluginClassesPaths)) { for (String pluginClassPath : StringUtils.splitByWholeSeparator(pluginClassesPaths, StreamingAppMasterService.PLUGINS_CONF_SEP)) { localJarFiles.addAll(JarHelper.getApexDependentJarsByClass(pluginClassPath)); } } LOG.info("Local jar file dependencies: " + localJarFiles); return localJarFiles; }

Target:
public LinkedHashSet<String> findJars(Class<?>[] defaultClasses) { List<Class<?>> jarClasses = new ArrayList<>(); for (String className : dag.getClassNames()) { try { Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className); jarClasses.add(clazz); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Failed to load class " + className, e); } } for (Class<?> clazz : Lists.newArrayList(jarClasses)) { for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) { jarClasses.add(c); jarClasses.addAll(Arrays.asList(c.getInterfaces())); } } jarClasses.addAll(Arrays.asList(defaultClasses)); if (dag.isDebug()) { LOG.debug("Deploy dependencies: {}", jarClasses); } LinkedHashSet<String> localJarFiles = new LinkedHashSet<>(); JarHelper jarHelper = new JarHelper(); for (Class<?> jarClass : jarClasses) { localJarFiles.addAll(jarHelper.getJars(jarClass)); } String libJarsPath = dag.getValue(Context.DAGContext.LIBRARY_JARS); if (!StringUtils.isEmpty(libJarsPath)) { String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP); localJarFiles.addAll(Arrays.asList(libJars)); } String pluginClassesPaths = conf.get(StreamingAppMasterService.PLUGINS_CONF_KEY); if (!StringUtils.isEmpty(pluginClassesPaths)) { for (String pluginClassPath : StringUtils.splitByWholeSeparator(pluginClassesPaths, StreamingAppMasterService.PLUGINS_CONF_SEP)) { try { localJarFiles.addAll(jarHelper.getJars(Thread.currentThread().getContextClassLoader().loadClass(pluginClassPath))); } catch (ClassNotFoundException ex) { LOG.error("Cannot find the class {}", pluginClassPath, ex); } } } LOG.info("Local jar file dependencies: {}", localJarFiles); return localJarFiles; }