private static Set<TypeMirror> getExcludedAnnotationTypes(Element element) {
    Optional<AnnotationMirror> maybeAnnotation =
        getAnnotationMirror(element, COPY_ANNOTATIONS_NAME);
    if (!maybeAnnotation.isPresent()) {
      return ImmutableSet.of();
    }

    @SuppressWarnings("unchecked")
    List<AnnotationValue> excludedClasses =
        (List<AnnotationValue>) getAnnotationValue(maybeAnnotation.get(), "exclude").getValue();
    // It turns out that if you write `@AutoValue.CopyAnnotations(exclude = {Missing.class})`, where
    // `Missing` is a class that does not exist, then javac will represent it as a String in the
    // AnnotationValue, rather than an ErrorType as you might expect. So we filter out anything that
    // is not a DeclaredType. (ErrorType *is* a DeclaredType.) Presumably you'll get a compilation
    // error because of the missing class. If another compiler uses ErrorType instead of String,
    // then we'll just add that ErrorType to the returned TypeMirrorSet here, where it will
    // presumably be ignored, or perhaps match the ErrorType for `@Missing` somewhere else in the
    // code.
    // This is a pretty obscure case so our main concern here is to avoid a ClassCastException.
    return excludedClasses.stream()
        .map(AnnotationValue::getValue)
        .filter(DeclaredType.class::isInstance)
        .map(DeclaredType.class::cast)
        .collect(toCollection(TypeMirrorSet::new));
  }
Returns the contents of the {@code AutoValue.CopyAnnotations.exclude} element, as a set of
{@code TypeMirror} where each type is an annotation type.
value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java