void maybeWriteGwtSerializer(AutoValueTemplateVars autoVars, String finalSubclass) {
    if (shouldWriteGwtSerializer()) {
      GwtTemplateVars vars = new GwtTemplateVars();
      vars.pkg = autoVars.pkg;
      vars.subclass = finalSubclass;
      vars.formalTypes = autoVars.formalTypes;
      vars.actualTypes = autoVars.actualTypes;
      vars.useBuilder = !autoVars.builderTypeName.isEmpty();
      vars.builderSetters = autoVars.builderSetters;
      vars.builderPropertyBuilders = autoVars.builderPropertyBuilders;
      vars.generated = autoVars.generated;
      String className =
          (vars.pkg.isEmpty() ? "" : vars.pkg + ".") + vars.subclass + "_CustomFieldSerializer";
      vars.serializerClass = TypeSimplifier.simpleNameOf(className);
      vars.props =
          autoVars.props.stream().map(p -> new Property((GetterProperty) p)).collect(toList());
      vars.classHashString = computeClassHash(autoVars.props, vars.pkg);
      String text = vars.toText();
      text = TypeEncoder.decode(text, processingEnv, vars.pkg, type.asType());
      writeSourceFile(className, text, type);
    }
  }
Writes the GWT serializer for the given type, if appropriate. An {@code @AutoValue} class gets
a GWT serializer if it is annotated with {@code @GwtCompatible(serializable = true)}, where the
{@code @GwtCompatible} annotation can come from any package.

<p>If the type is com.example.Foo then the generated AutoValue subclass is
com.example.AutoValue_Foo and the GWT serializer is
com.example.AutoValue_Foo_CustomFieldSerializer.

@param autoVars the template variables defined for this type.
@param finalSubclass the simple name of the AutoValue class being generated, AutoValue_Foo in
    the example.
value/src/main/java/com/google/auto/value/processor/GwtSerialization.java