public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) {
    checkNotNull(type);
    ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder();
    type.accept(ReferencedTypes.INSTANCE, elements);
    return elements.build();
  }
Returns the set of {@linkplain TypeElement types} that are referenced by the given {@link
TypeMirror}.
common/src/main/java/com/google/auto/common/MoreTypes.java