public static PsiType keepStrictlyTypeUseAnnotations(@Nullable PsiModifierList modifierList, @NotNull PsiType type) {
    if (modifierList == null) return type;
    List<PsiAnnotation> annotations = new ArrayList<>();
    PsiAnnotation[] originalAnnotations = type.getAnnotations();
    for (PsiAnnotation annotation : originalAnnotations) {
      if (isStrictlyTypeUseAnnotation(modifierList, annotation)) {
        annotations.add(annotation);
      }
    }
    
    if (originalAnnotations.length == annotations.size()) {
      return type;
    }

    return annotations.isEmpty()
           ? type.annotate(TypeAnnotationProvider.EMPTY)
           : type.annotate(TypeAnnotationProvider.Static.create(annotations.toArray(PsiAnnotation.EMPTY_ARRAY)));
  }
public static PsiType keepStrictlyTypeUseAnnotations(@Nullable PsiModifierList modifierList, @NotNull PsiType type)