private static Optional<AnnotationSpec.Builder> generatedAnnotationSpecBuilder(
      Elements elements, SourceVersion sourceVersion, Class<?> processorClass) {
    return GeneratedAnnotations.generatedAnnotation(elements, sourceVersion)
        .map(
            generated ->
                AnnotationSpec.builder(ClassName.get(generated))
                    .addMember("value", "$S", processorClass.getCanonicalName()));
  }
Returns {@code @Generated(value = "processorClass", comments = "comments")} for the target
{@code SourceVersion}.

<p>Returns {@code javax.annotation.processing.Generated} for JDK 9 and newer, {@code
javax.annotation.Generated} for earlier releases, and Optional#empty()} if the annotation is
not available.
common/src/main/java/com/google/auto/common/GeneratedAnnotationSpecs.java