private static @NotNull Collection<File> getClasspathFiles(ModuleChunk chunk,
                                                             JpsJavaClasspathKind kind,
                                                             boolean excludeMainModuleOutput,
                                                             ClasspathPart classpathPart,
                                                             boolean exportedOnly) {
    final Set<File> files = new LinkedHashSet<>();
    for (JpsModule module : chunk.getModules()) {
      JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(module).includedIn(kind).recursively();
      if (exportedOnly) {
        enumerator = enumerator.exportedOnly();
      }
      if (classpathPart == ClasspathPart.BEFORE_JDK || classpathPart == ClasspathPart.BEFORE_PLUS_JDK) {
        enumerator = enumerator.satisfying(new BeforeJavaSdkItemFilter(module));
      }
      else if (classpathPart == ClasspathPart.AFTER_JDK) {
        enumerator = enumerator.satisfying(new AfterJavaSdkItemFilter(module));
      }
      JpsJavaDependenciesRootsEnumerator rootsEnumerator = enumerator.classes();
      if (excludeMainModuleOutput) {
        rootsEnumerator = rootsEnumerator.withoutSelfModuleOutput();
      }
      files.addAll(rootsEnumerator.getRoots());
    }

    if (classpathPart == ClasspathPart.BEFORE_PLUS_JDK) {
      for (JpsModule module : chunk.getModules()) {
        JpsSdk<JpsDummyElement> sdk = module.getSdk(JpsJavaSdkType.INSTANCE);
        if (sdk != null) {
          files.addAll(sdk.getParent().getFiles(JpsOrderRootType.COMPILED));
        }
      }
    }
    return files;
  }
private static @NotNull Collection<File> getClasspathFiles(ModuleChunk chunk,
                                                             JpsJavaClasspathKind kind,
                                                             boolean excludeMainModuleOutput,
                                                             ClasspathPart classpathPart,
                                                             boolean exportedOnly)