private static void performModification(@NotNull PsiMethod method,
                                            @NotNull PsiParameter @NotNull [] parameters,
                                            @NotNull PsiParameter lastParameter,
                                            @NotNull PsiTypeElement typeElement,
                                            @NotNull List<PsiElement> references) {
      final PsiEllipsisType type = (PsiEllipsisType)lastParameter.getType();
      final PsiType componentType = type.getComponentType();
      final String typeText;
      if (componentType instanceof PsiClassType classType) {
        typeText = classType.rawType().getCanonicalText();
      }
      else {
        typeText = componentType.getCanonicalText();
      }
      for (PsiElement reference : references) {
        modifyCall(typeText, parameters.length - 1, reference);
      }
      final PsiType arrayType = type.toArrayType();
      final PsiTypeElement newTypeElement = JavaPsiFacade.getElementFactory(lastParameter.getProject()).createTypeElement(arrayType);
      final PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, CommonClassNames.JAVA_LANG_SAFE_VARARGS);
      if (annotation != null) {
        annotation.delete();
      }
      new CommentTracker().replaceAndRestoreComments(typeElement, newTypeElement);
    }
private static void performModification(@NotNull PsiMethod method,
                                            @NotNull PsiParameter @NotNull [] parameters,
                                            @NotNull PsiParameter lastParameter,
                                            @NotNull PsiTypeElement typeElement,
                                            @NotNull List<PsiElement> references)