private MethodSpec writeReplace() {
      ImmutableList<CodeBlock> properties =
          propertyMirrors.stream()
              .map(propertyMirror -> CodeBlock.of("$L()", propertyMirror.getMethod()))
              .collect(toImmutableList());

      return MethodSpec.methodBuilder("writeReplace")
          .returns(Object.class)
          .addStatement(
              "return new $T($L)",
              getClassTypeName(
                  ClassName.get(
                      context.packageName(),
                      className,
                      SerializableAutoValueExtension.ProxyGenerator.PROXY_CLASS_NAME),
                  typeVariableNames),
              CodeBlock.join(properties, ", "))
          .build();
    }
Creates an implementation of writeReplace that delegates serialization to its inner Proxy
class.
value/src/main/java/com/google/auto/value/extension/serializable/processor/SerializableAutoValueExtension.java