Iterate through all modules in environment when reloading TypeRegistryImpl
@@ -83,17 +83,11 @@ public void reload(ModuleEnvironment environment) {
initializeReflections(finalClassLoader, environment);
}
- private Set<ModuleClassLoader> initializeReflections(ClassLoader classLoader) {
+ private void initializeReflections(ClassLoader classLoader) {
List<ClassLoader> allClassLoaders = Lists.newArrayList();
- Set<ModuleClassLoader> moduleClassLoaders = Sets.newHashSet();
while (classLoader != null) {
allClassLoaders.add(classLoader);
-
- if (classLoader instanceof ModuleClassLoader) {
- moduleClassLoaders.add((ModuleClassLoader) classLoader);
- }
-
classLoader = classLoader.getParent();
}
@@ -120,14 +114,12 @@ public void reload(ModuleEnvironment environment) {
.useParallelExecutor()
);
- return moduleClassLoaders;
}
private void initializeReflections(ClassLoader classLoader, ModuleEnvironment environment) {
- Set<ModuleClassLoader> moduleClassLoaders = initializeReflections(classLoader);
+ initializeReflections(classLoader);
- for (ModuleClassLoader loader : moduleClassLoaders) {
- Module module = environment.get(loader.getModuleId());
+ for (Module module : environment.getModulesOrderedByDependencies()) {
reflections.merge(module.getReflectionsFragment());
}
}
