public static InstrumentationClassFinder createInstrumentationClassFinder(@Nullable JpsSdk<?> sdk,
                                                                            Collection<? extends File> platformCp,
                                                                            Collection<? extends File> cp,
                                                                            OutputConsumer outputConsumer) throws MalformedURLException {
    final URL[] platformUrls;
    int index = 0;
    if (sdk != null && JpsJavaSdkType.getJavaVersion(sdk) >= 9) {
      platformUrls = new URL[1 + platformCp.size()];
      platformUrls[index++] = InstrumentationClassFinder.createJDKPlatformUrl(sdk.getHomePath());
    }
    else {
      platformUrls = new URL[platformCp.size()];
    }

    for (File file : platformCp) {
      platformUrls[index++] = file.toURI().toURL();
    }

    final URL[] urls = new URL[cp.size()];
    index = 0;
    for (File file : cp) {
      urls[index++] = file.toURI().toURL();
    }

    return new InstrumentationClassFinder(platformUrls, urls) {
      @Override
      protected InputStream lookupClassBeforeClasspath(String internalClassName) {
        final BinaryContent content = outputConsumer.lookupClassBytes(internalClassName.replace("/", "."));
        if (content != null) {
          return new ByteArrayInputStream(content.getBuffer(), content.getOffset(), content.getLength());
        }
        return null;
      }
    };
  }
public static InstrumentationClassFinder createInstrumentationClassFinder(@Nullable JpsSdk<?> sdk,
                                                                            Collection<? extends File> platformCp,
                                                                            Collection<? extends File> cp,
                                                                            OutputConsumer outputConsumer)