static String sourceFormForAnnotation(AnnotationMirror annotationMirror) {
    // If a value in the annotation is a reference to a class constant and that class constant is
    // undefined, javac unhelpfully converts it into a string "<error>" and visits that instead. We
    // want to catch this case and defer processing to allow the class to be defined by another
    // annotation processor. So we look for annotation elements whose type is Class but whose
    // reported value is a string. Unfortunately we can't extract the ErrorType corresponding to the
    // missing class portably. With javac, the AttributeValue is a
    // com.sun.tools.javac.code.Attribute.UnresolvedClass, which has a public field classType that
    // is the ErrorType we need, but obviously that's nonportable and fragile.
    validateClassValues(annotationMirror);
    StringBuilder sb = new StringBuilder();
    new AnnotationSourceFormVisitor().visitAnnotation(annotationMirror, sb);
    return sb.toString();
  }
Returns a string representation of the given annotation mirror, suitable for inclusion in a
Java source file to reproduce the annotation in source form.
value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java