public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults(
      AnnotationMirror annotation) {
    ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder();
    // Use unmodifiableMap to eliminate wildcards, which cause issues for our nullness checker.
    @SuppressWarnings("GetElementValues")
    Map<ExecutableElement, AnnotationValue> declaredValues =
        unmodifiableMap(annotation.getElementValues());
    for (ExecutableElement method :
        ElementFilter.methodsIn(annotation.getAnnotationType().asElement().getEnclosedElements())) {
      // Must iterate and put in this order, to ensure consistency in generated code.
      if (declaredValues.containsKey(method)) {
        values.put(method, declaredValues.get(method));
      } else if (method.getDefaultValue() != null) {
        values.put(method, method.getDefaultValue());
      } else {
        throw new IllegalStateException(
            "Unset annotation value without default should never happen: "
                + MoreElements.asType(method.getEnclosingElement()).getQualifiedName()
                + '.'
                + method.getSimpleName()
                + "()");
      }
    }
    return values.build();
  }
Returns the {@link AnnotationMirror}'s map of {@link AnnotationValue} indexed by {@link
ExecutableElement}, supplying default values from the annotation if the annotation property has
not been set. This is equivalent to {@link
Elements#getElementValuesWithDefaults(AnnotationMirror)} but can be called statically without
an {@link Elements} instance.

<p>The iteration order of elements of the returned map will be the order in which the {@link
ExecutableElement}s are defined in {@code annotation}'s {@linkplain
AnnotationMirror#getAnnotationType() type}.
common/src/main/java/com/google/auto/common/AnnotationMirrors.java