void defineVarsForAutoValue(
        AutoValueOrBuilderTemplateVars vars,
        ImmutableBiMap<ExecutableElement, String> getterToPropertyName,
        Nullables nullables,
        ImmutableSet<ExecutableElement> consumedBuilderAbstractMethods) {
      Iterable<ExecutableElement> builderMethods =
          Sets.difference(builderAbstractMethods, consumedBuilderAbstractMethods);
      boolean autoValueHasToBuilder = toBuilderMethods != null && !toBuilderMethods.isEmpty();
      ImmutableMap<ExecutableElement, AnnotatedTypeMirror> getterToPropertyType =
          TypeVariables.rewriteReturnTypes(
              processingEnv.getTypeUtils(),
              getterToPropertyName.keySet(),
              autoValueClass,
              builderTypeElement);
      ImmutableMap.Builder<String, AnnotatedTypeMirror> rewrittenPropertyTypes =
          ImmutableMap.builder();
      getterToPropertyType.forEach(
          (getter, type) -> rewrittenPropertyTypes.put(getterToPropertyName.get(getter), type));
      Optional<BuilderMethodClassifier<ExecutableElement>> optionalClassifier =
          BuilderMethodClassifierForAutoValue.classify(
              builderMethods,
              errorReporter,
              processingEnv,
              autoValueClass,
              builderTypeElement,
              getterToPropertyName,
              rewrittenPropertyTypes.build(),
              nullables,
              autoValueHasToBuilder);
      if (!optionalClassifier.isPresent()) {
        return;
      }
      for (ExecutableElement method : methodsIn(builderTypeElement.getEnclosedElements())) {
        if (method.getSimpleName().contentEquals("builder")
            && method.getModifiers().contains(Modifier.STATIC)
            && method.getAnnotationMirrors().isEmpty()
            && !(vars instanceof AutoBuilderTemplateVars)) {
          // For now we don't warn for methods with annotations, because for example we do want to
          // allow Jackson's @JsonCreator. We also don't warn if this is an @AutoBuilder.
          errorReporter.reportWarning(
              method,
              "[AutoValueBuilderInBuilder] Static builder() method should be in the containing"
                  + " class");
        }
      }
      defineVars(vars, optionalClassifier.get());
    }
Finds any methods in the set that return the builder type. If the builder has type parameters
{@code <A, B>}, then the return type of the method must be {@code Builder<A, B>} with the
same parameter names. We enforce elsewhere that the names and bounds of the builder
parameters must be the same as those of the {@code @AutoValue} class. Here's a correct
example:

<pre>{@code
@AutoValue abstract class Foo<A extends Number, B> {
  abstract int someProperty();

  abstract Builder<A, B> toBuilder();

  interface Builder<A extends Number, B> {...}
}
}</pre>

<p>We currently impose that there cannot be more than one such method.
value/src/main/java/com/google/auto/value/processor/BuilderSpec.java