void (PsiMethod method) { final PsiParameterList parameterList = method.getParameterList(); if (parameterList.isEmpty()) { return; } final PsiParameter[] parameters = parameterList.getParameters(); final PsiParameter lastParameter = parameters[parameters.length - 1]; lastParameter.normalizeDeclaration(); final PsiType type = lastParameter.getType(); if (!(type instanceof PsiArrayType arrayType)) { return; } final PsiType componentType = arrayType.getComponentType(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(method.getProject()); final PsiType ellipsisType = new PsiEllipsisType(componentType, TypeAnnotationProvider.Static.create(type.getAnnotations())); final PsiTypeElement newTypeElement = factory.createTypeElement(ellipsisType); final PsiTypeElement typeElement = lastParameter.getTypeElement(); if (typeElement != null) { typeElement.replace(newTypeElement); } }