code: private static String javaLangSpelling(
        Elements elementUtils, String codePackageName, TypeElement typeElement) {
      // If this is java.lang.Thread.State or the like, we have to look for a clash with Thread.
      TypeElement topLevelType = topLevelType(typeElement);
      TypeElement clash =
          elementUtils.getTypeElement(codePackageName + "." + topLevelType.getSimpleName());
      String fullName = typeElement.getQualifiedName().toString();
      return (clash == null) ? fullName.substring("java.lang.".length()) : fullName;
    }
docs: Handles the tricky case where the class being referred to is in {@code java.lang}, but the
  package of the referring code contains another class of the same name. For example, if the
  current package is {@code foo.bar} and there is a {@code foo.bar.Compiler}, then we will refer
  to {@code java.lang.Compiler} by its full name. The plain name {@code Compiler} would reference
  {@code foo.bar.Compiler} in this case. We need to write {@code java.lang.Compiler} even if the
  other {@code Compiler} class is not being considered here, so the {@link #ambiguousNames} logic
  is not enough. We have to look to see if the class exists.