List<OutputItem> (CompilationUnit compilationUnit, final File stubDirectory) { final List<OutputItem> compiledFiles = new ArrayList<>(); compilationUnit.applyToPrimaryClassNodes(new CompilationUnit.PrimaryClassNodeOperation() { @Override public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException { final String topLevel = classNode.getName(); String fileName = source.getName(); if (fileName.startsWith("file:")) { try { fileName = new URL(fileName).getFile(); } catch (MalformedURLException ignored) { } } OutputItem item = new OutputItem(stubDirectory, topLevel.replace('.', '/') + ".java", fileName); if (new File(item.outputPath).exists()) { compiledFiles.add(item); } } @SuppressWarnings("RedundantMethodOverride") public void doPhaseOperation(CompilationUnit unit) throws CompilationFailedException { super.doPhaseOperation(unit); } }); return compiledFiles; }