private static void appendEscaped(StringBuilder sb, char c) {
    switch (c) {
      case '\\':
      case '"':
      case '\'':
        sb.append('\\').append(c);
        break;
      case '\n':
        sb.append("\\n");
        break;
      case '\r':
        sb.append("\\r");
        break;
      case '\t':
        sb.append("\\t");
        break;
      default:
        if (c < 0x20) {
          sb.append(String.format("\\%03o", (int) c));
        } else if (c < 0x7f || Character.isLetter(c)) {
          sb.append(c);
        } else {
          sb.append(String.format("\\u%04x", (int) c));
        }
        break;
    }
  }
Returns a string representation of the given annotation mirror, suitable for inclusion in a
Java source file to reproduce the annotation in source form.
common/src/main/java/com/google/auto/common/AnnotationOutput.java