TypeSpec.Builder extensionClassBuilder() {
    TypeSpec.Builder builder =
        classBuilder(className)
            .superclass(superType())
            .addAnnotations(
                context.classAnnotationsToCopy(context.autoValueClass()).stream()
                    .map(AnnotationSpec::get)
                    .collect(toImmutableList()))
            .addTypeVariables(annotatedTypeVariableNames())
            .addModifiers(isFinal ? FINAL : ABSTRACT)
            .addMethod(constructor());
    generatedAnnotationSpec(elements, sourceVersion, ToPrettyStringExtension.class)
        .ifPresent(builder::addAnnotation);
    return builder;
  }
A factory for {@link TypeSpec}s used in {@link AutoValueExtension} implementations.

<p>This is copied from {@link
com.google.auto.value.extension.memoized.processor.MemoizeExtension} until we find a better
location to consolidate the code.
value/src/main/java/com/google/auto/value/extension/toprettystring/processor/ExtensionClassTypeSpecBuilder.java