Boolean (@NotNull LibraryEx library, String[] annotationUrls, String[] excludedRootUrls, List<OrderRoot> roots) { List<String> allRootUrls = new ArrayList<>(); Set<Pair<OrderRootType, String>> actualRoots = new HashSet<>(); for (OrderRootType rootType : OrderRootType.getAllTypes()) { for (String url : library.getUrls(rootType)) { actualRoots.add(new Pair<>(rootType, url)); allRootUrls.add(url); } } Set<Pair<OrderRootType, String>> expectedRoots = new HashSet<>(); for (OrderRoot root : roots) { // intentionally ignoring jar directory flag, it implausible for our case to change // from jar directory to jar file preserving url expectedRoots.add(new Pair<>(root.getType(), root.getFile().getUrl())); } for (String annotationUrl : annotationUrls) { expectedRoots.add(new Pair<>(AnnotationOrderRootType.getInstance(), annotationUrl)); } if (!actualRoots.equals(expectedRoots)) { return false; } Set<String> expectedExcludedRootUrls = Arrays.stream(excludedRootUrls) .filter(excludedRootUrl -> VfsUtilCore.isUnder(excludedRootUrl, allRootUrls)) .collect(Collectors.toSet()); Set<String> actualExcludedRootUrls = Arrays.stream(library.getExcludedRootUrls()).collect(Collectors.toSet()); if (!expectedExcludedRootUrls.equals(actualExcludedRootUrls)) { return false; } return true; }