private static Map<ObjectMethod, ExecutableElement> determineObjectMethodsToGenerate(
      Set<ExecutableElement> methods) {
    Map<ObjectMethod, ExecutableElement> methodsToGenerate = new EnumMap<>(ObjectMethod.class);
    for (ExecutableElement method : methods) {
      ObjectMethod override = objectMethodToOverride(method);
      boolean canGenerate =
          method.getModifiers().contains(Modifier.ABSTRACT)
              || isJavaLangObject(MoreElements.asType(method.getEnclosingElement()));
      if (!override.equals(ObjectMethod.NONE) && canGenerate) {
        methodsToGenerate.put(override, method);
      }
    }
    return methodsToGenerate;
  }
Given a list of all methods defined in or inherited by a class, returns a map indicating which
of equals, hashCode, and toString should be generated. Each value in the map is the method that
will be overridden by the generated method, which might be a method in {@code Object} or an
abstract method in the {@code @AutoValue} class or an ancestor.
value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java