void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getStartElement(); if (!(element instanceof PsiExpression expression)) return; PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiExpression replacement = factory.createExpressionFromText(ParenthesesUtils.getText(expression, ParenthesesUtils.POSTFIX_PRECEDENCE) + "." + myMethodName + "()", expression); PsiElement parent = expression.getParent().getParent(); if (parent instanceof PsiMethodCallExpression && MethodUtils.isToString(((PsiMethodCallExpression)parent).resolveMethod())) { element = parent; } PsiElement result = element.replace(replacement); CodeStyleManager.getInstance(project).reformat(result); }