@Override public boolean process( Set<? extends TypeElement> supportedAnnotations, RoundEnvironment roundEnvironment) { // short-circuit if there are multiple rounds if (_isComplete) { return true; } Collection<String> processedPackageNames = new LinkedHashSet<String>(); for (Element e : roundEnvironment.getElementsAnnotatedWith(RequestMapping.class)) { if (e instanceof ExecutableElement) { addPackageName(processedPackageNames, e); processRequestMappingMethod((ExecutableElement) e); } } if (_docs.getResources().size() > 0) { OutputStream fout = null; try { FileObject file = getOutputFile(); boolean exists = new File(file.getName()).exists(); fout = file.openOutputStream(); _docs.toStream(fout); processingEnv .getMessager() .printMessage( Diagnostic.Kind.NOTE, String.format( "Wrote REST docs for %s endpoints to %s file at %s", _docs.getResources().size(), exists ? "existing" : "new", file.getName())); } catch (Exception e) { throw new RuntimeException(e); // TODO wrap in something nicer } finally { if (fout != null) { try { fout.close(); } catch (IOException ignored) { // ignored } } } } _isComplete = true; return true; }