void updateDependencies(CompileContext context,
                          List<File> toCompile,
                          MultiMap<T, OutputItem> successfullyCompiled,
                          final GroovyOutputConsumer outputConsumer, Builder builder) {
    JavaBuilderUtil.registerFilesToCompile(context, toCompile);
    if (!successfullyCompiled.isEmpty()) {

      final Callbacks.Backend callback = JavaBuilderUtil.getDependenciesRegistrar(context);

      for (Map.Entry<T, Collection<OutputItem>> entry : successfullyCompiled.entrySet()) {
        final T target = entry.getKey();
        final Collection<OutputItem> compiled = entry.getValue();
        for (OutputItem item : compiled) {
          final String sourcePath = FileUtil.toSystemIndependentName(item.sourcePath);
          final String outputPath = FileUtil.toSystemIndependentName(item.outputPath);
          final File outputFile = new File(outputPath);
          final File srcFile = new File(sourcePath);
          try {
            final byte[] bytes = FileUtil.loadFileBytes(outputFile);
            if (Utils.IS_TEST_MODE || LOG.isDebugEnabled()) {
              LOG.debug("registerCompiledClass " + outputFile + " from " + srcFile);
            }
            outputConsumer.registerCompiledClass(target, srcFile, outputFile, bytes);
            callback.associate(outputPath, sourcePath, new FailSafeClassReader(bytes));
          }
          catch (Throwable e) {
            // need this to make sure that unexpected errors in, for example, ASM will not ruin the compilation
            final String message = GroovyJpsBundle.message("incomplete.dependency.for.class.0", item.outputPath);
            LOG.info(message, e);
            context.processMessage(new CompilerMessage(
              builder.getPresentableName(), BuildMessage.Kind.WARNING,
              message + "\n" + CompilerMessage.getTextFromThrowable(e),
              sourcePath
            ));
          }
          JavaBuilderUtil.registerSuccessfullyCompiled(context, srcFile);
        }
      }
    }
  }
void updateDependencies(CompileContext context,
                          List<File> toCompile,
                          MultiMap<T, OutputItem> successfullyCompiled,
                          final GroovyOutputConsumer outputConsumer, Builder builder)