void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiElement parent = element.getParent(); if (parent instanceof PsiMethodReferenceExpression) { final PsiExpression qualifierExpression = ((PsiMethodReferenceExpression)parent).getQualifierExpression(); if (qualifierExpression != null) { parent.replace(qualifierExpression); } } if (parent instanceof PsiReturnStatement || parent instanceof PsiExpressionStatement) { parent = PsiTreeUtil.getParentOfType(parent, PsiLambdaExpression.class); } if (parent instanceof PsiLambdaExpression) { PsiExpression expression = LambdaUtil.extractSingleExpressionFromBody(((PsiLambdaExpression)parent).getBody()); if (expression instanceof PsiMethodCallExpression) { PsiExpression qualifierExpression = ((PsiMethodCallExpression)expression).getMethodExpression().getQualifierExpression(); if (qualifierExpression != null) { parent.replace(qualifierExpression); } } } }