PsiMethodReferenceExpression (PsiMethod method, PsiMethodReferenceExpression place) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(method.getProject()); PsiMethodReferenceExpression copy = (PsiMethodReferenceExpression)place.copy(); PsiElement referenceNameElement = copy.getReferenceNameElement(); LOG.assertTrue(referenceNameElement != null, copy); referenceNameElement.replace(method.isConstructor() ? factory.createKeyword("new") : factory.createIdentifier(method.getName())); return copy; }