I am using the google Reflections package to build an index of all classes that are available for calling. The following code is supposed to return all classes that are loaded in the JVM:
List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());
Reflections reflections = new Reflections(new ConfigurationBuilder()
.setScanners(new SubTypesScanner(false), new ResourcesScanner())
.setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))));
Set<Class<? extends Object>> allClasses =
reflections.getSubTypesOf(Object.class);
I note that the set it returns does not contain anything in the java.* domain. Can someone familiar with the Reflections package advise me on how to get these as well? Thanks!