public static boolean hasTypeAnnotation(@NotNull PsiType type) {
    return type.accept(new PsiTypeVisitor<Boolean>() {
      @Override
      public Boolean visitType(@NotNull PsiType type) {
        return type.getAnnotations().length > 0;
      }

      @Override
      public Boolean visitClassType(@NotNull PsiClassType classType) {
        if (super.visitClassType(classType)) {
          return true;
        }

        for (PsiType t1 : classType.getParameters()) {
          if (t1.accept(this)) {
            return true;
          }
        }
        return false;
      }

      @Override
      public Boolean visitArrayType(@NotNull PsiArrayType arrayType) {
        return super.visitArrayType(arrayType) || arrayType.getComponentType().accept(this);
      }

      @Override
      public Boolean visitWildcardType(@NotNull PsiWildcardType wildcardType) {
        return super.visitWildcardType(wildcardType) || wildcardType.getBound() != null && wildcardType.getBound().accept(this);
      }

      @Override
      public Boolean visitIntersectionType(@NotNull PsiIntersectionType intersectionType) {
        for (PsiType t1 : intersectionType.getConjuncts()) {
          if (t1.accept(this)) {
            return true;
          }
        }
        return false;
      }

      @Override
      public Boolean visitDisjunctionType(@NotNull PsiDisjunctionType disjunctionType) {
        for (PsiType t1 : disjunctionType.getDisjunctions()) {
          if (t1.accept(this)) {
            return true;
          }
        }
        return false;
      }
    });
  }
public static boolean hasTypeAnnotation(@NotNull PsiType type)