private void writeSourceFile(String className, String text, TypeElement originatingType) {
    try {
      JavaFileObject sourceFile =
          processingEnv.getFiler().createSourceFile(className, originatingType);
      try (Writer writer = sourceFile.openWriter()) {
        writer.write(text);
      }
    } catch (IOException e) {
      processingEnv
          .getMessager()
          .printMessage(
              Diagnostic.Kind.WARNING, "Could not write generated class " + className + ": " + e);
      // A warning rather than an error for the reason explained in
      // AutoValueishProcessor.writeSourceFile.
    }
  }
A string that should change if any salient details of the serialized class change.
value/src/main/java/com/google/auto/value/processor/GwtSerialization.java