ExitCode (CompileContext context, ModuleChunk chunk, InstrumentationClassFinder finder, OutputConsumer outputConsumer) { ExitCode exitCode = ExitCode.NOTHING_DONE; if (!outputConsumer.getCompiledClasses().isEmpty()) { final Map<ModuleBuildTarget, Collection<ClassItem>> remoteClasses = new HashMap<>(); for (ModuleBuildTarget target : chunk.getTargets()) { for (CompiledClass compiledClass : outputConsumer.getTargetCompiledClasses(target)) { try { if (isRemote(compiledClass, finder)) { Collection<ClassItem> list = remoteClasses.get(target); if (list == null) { list = new ArrayList<>(); remoteClasses.put(target, list); } list.add(new ClassItem(compiledClass)); } } catch (IOException e) { context.processMessage(new CompilerMessage(getPresentableName(), e)); } } } if (!remoteClasses.isEmpty()) { exitCode = generateRmiStubs(context, remoteClasses, chunk, outputConsumer); } } return exitCode; }