public static Optional<TypeElement> generatedAnnotation(
      Elements elements, SourceVersion sourceVersion) {
    return Optional.ofNullable(
        elements.getTypeElement(
            sourceVersion.compareTo(SourceVersion.RELEASE_8) > 0
                ? "javax.annotation.processing.Generated"
                : "javax.annotation.Generated"));
  }
Returns the element corresponding to the {@code @Generated} annotation present at 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/GeneratedAnnotations.java