/** * * Searches for classpath entries on the classpath, starting on the given input classloader, and scanning * recursively it's parents, all the way until the JVM bootstrap classloader. * * @param classLoader the class loader to be scanned * * @return the list of classpath entries found on the given class loader. */ private List<ClazzLoader> findAllClassLoaders(ClassLoader classLoader) { List<ClazzLoader> classLoaders = new ArrayList<>(); if (classLoader != null) { ClazzLoader cl = ClazzLoaderFactory.createClazzLoader(classLoader); if (cl != null) { classLoaders.add(cl); } classLoaders.addAll(findAllClassLoaders(classLoader.getParent())); } // if the class loader is null, means we got all the way to the bootstrap class loader - add it as well else { classLoaders.add(ClazzLoaderFactory.createBootstrapClassLoader()); } return classLoaders; }
/** * * Searches for classpath entries on the classpath, starting on the given input classloader, and scanning * recursively it's parents, all the way until the JVM bootstrap classloader. * * @param classLoader the class loader to be scanned * * @return the list of classpath entries found on the given class loader. */ private List<ClazzLoader> findAllClassLoaders(ClassLoader classLoader) { List<ClazzLoader> classLoaders = new ArrayList<>(); if (classLoader != null) { ClazzLoader cl = ClazzLoaderFactory.createClazzLoader(classLoader); if (cl != null) { classLoaders.add(cl); } classLoaders.addAll(findAllClassLoaders(classLoader.getParent())); } // if the class loader is null, means we got all the way to the bootstrap class loader - add it as well else { classLoaders.add(ClazzLoaderFactory.createBootstrapClassLoader()); } return classLoaders; }