StaticGsonProcessor extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (annotations.isEmpty()) { return true; } long t0 = System.currentTimeMillis(); StaticGsonContext context = new StaticGsonContext(roundEnv, processingEnv); roundEnv.getElementsAnnotatedWith(JsonSerializable.class) .stream() .map(element -> new ModelDefinition(context, (TypeElement) element)) .forEach(context::addModel); context.modelMap.values() .parallelStream() .map(model -> new TypeAdapterFactoryWriter(context, model)) .forEach(TypeAdapterFactoryWriter::write); processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "[StaticGson] processed " + context.modelMap.size() + " of models in " + (System.currentTimeMillis() - t0) + "ms"); return true; }  @Override boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv);  }
@Test public void process() throws Exception { JavaFileObject modelFile = JavaFileObjects.forResource("Book.java"); assert_().about(javaSource()) .that(modelFile) .processedWith(new StaticGsonProcessor()) .compilesWithoutWarnings(); }