Collection<String> () { final Collection<String> result = new LinkedHashSet<>(); myOrderEnumerator.forEach((orderEntry, customHandlers) -> { OrderRootType type = getRootType(orderEntry); if (orderEntry instanceof ModuleSourceOrderEntry) { boolean includeTests = !myOrderEnumerator.isProductionOnly(); collectModuleRootsUrls(type, ((ModuleSourceOrderEntry)orderEntry).getRootModel(), result, true, includeTests, customHandlers); } else if (orderEntry instanceof ModuleOrderEntry moduleOrderEntry) { final Module module = moduleOrderEntry.getModule(); if (module != null) { ModuleRootModel rootModel = myOrderEnumerator.getRootModel(module); boolean productionOnTests = ((ModuleOrderEntry)orderEntry).isProductionOnTestDependency(); boolean includeTests = !myOrderEnumerator.isProductionOnly() && OrderEnumeratorBase.shouldIncludeTestsFromDependentModulesToTestClasspath(customHandlers) || productionOnTests; collectModuleRootsUrls(type, rootModel, result, !productionOnTests, includeTests, customHandlers); } } else if (orderEntry instanceof LibraryOrSdkOrderEntry) { if (OrderEnumeratorBase.addCustomRootUrlsForLibraryOrSdk((LibraryOrSdkOrderEntry)orderEntry, type, result, customHandlers)) { return true; } Collections.addAll(result, ((LibraryOrSdkOrderEntry)orderEntry).getRootUrls(type)); } else { LOG.error("Unexpected implementation of OrderEntry: " + orderEntry.getClass().getName()); } return true; }); return result; }