void (PsiElement element, GrIntroduceParameterSettings settings) { if (element.getParent() instanceof GrMethodCallExpression methodCall) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(settings.getProject()); GrExpression expression = factory.createExpressionFromText(settings.getName(), null); final GrArgumentList argList = methodCall.getArgumentList(); final PsiElement[] exprs = argList.getAllArguments(); if (exprs.length > 0) { argList.addAfter(expression, exprs[exprs.length - 1]); } else { argList.add(expression); } removeParametersFromCall(methodCall, settings); } else { LOG.error("Unexpected parent type " + element.getParent()); } }