void (@NotNull ActionContext context, @NotNull PsiNewExpression newDeclaration, @NotNull ModPsiUpdater updater) { PsiJavaCodeReferenceElement reference = newDeclaration.getClassOrAnonymousClassReference(); if (reference == null) return; PsiElement qualifier = reference.getQualifier(); if (!(qualifier instanceof PsiJavaCodeReferenceElement referenceElement)) return; CommentTracker ct = new CommentTracker(); PsiReferenceParameterList parameterList = referenceElement.getParameterList(); if (parameterList != null) { ct.delete(parameterList); } ct.markRangeUnchanged(reference, Objects.requireNonNullElse(newDeclaration.getArgumentList(), reference)); String methodCallExpression = newDeclaration.getText().substring(reference.getStartOffsetInParent()); ct.replaceAndRestoreComments(newDeclaration, methodCallExpression); }