ModuleInfo (File f) { ModuleInfo info = myCache.get(f); if (info != null) { return info; } info = ModuleInfo.EMPTY; try { Object mf = myModuleFinderCreateMethod.invoke(null, (Object)new Path[]{f.toPath()}); // ModuleFinder.of(f.toPath()); final Set<?> moduleRefs = (Set<?>)myFindAll.invoke(mf); // mf.findAll() if (!moduleRefs.isEmpty()) { for (Object moduleRef : moduleRefs) { final Object descriptor = myGetDescriptor.invoke(moduleRef); // moduleRef.descriptor() final String moduleName = (String)myDescriptorName.invoke(descriptor); // descriptor.name(); final Set<?> requires = (Set<?>)myDescriptorRequires.invoke(descriptor); //descriptor.requires(); if (requires.isEmpty()) { info = new ModuleInfo(moduleName, false); } else { final Set<String> req = new HashSet<>(); for (Object require : requires) { req.add((String)myRequiresName.invoke(require)/*require.name()*/); } info = new ModuleInfo(moduleName, req); } break; } } else { final String explodedModuleName = deriveAutomaticModuleName(f); if (explodedModuleName != null) { info = new ModuleInfo(explodedModuleName, true); } } } catch (Throwable ignored) { } myCache.put(f, info); return info; }