@Override
      public TypeMirror visitDeclared(DeclaredType t, Void p) {
        if (t.getTypeArguments().isEmpty()) {
          return t;
        }
        TypeElement typeElement = asTypeElement(t);
        if (!visitingTypes.add(typeElement)) {
          return typeUtils.erasure(t);
        }
        List<TypeMirror> newArgs = Lists.newArrayList();
        for (TypeMirror arg : t.getTypeArguments()) {
          newArgs.add(visit(arg));
        }
        TypeMirror result =
            typeUtils.getDeclaredType(asTypeElement(t), newArgs.toArray(new TypeMirror[0]));
        visitingTypes.remove(typeElement);
        return result;
      }
Type elements that we are currently visiting. This helps us stay out of trouble when
looking at something like {@code Enum<E extends Enum<E>>}. At the second {@code Enum} we
will just return raw {@code Enum}.
common/src/main/java/com/google/auto/common/Overrides.java