String (@NotNull PsiLambdaExpression lambdaExpression) { PsiMember member = PsiTreeUtil.getParentOfType(lambdaExpression, PsiMethod.class, PsiClass.class, PsiField.class); final String methodPrefix; if (member instanceof PsiMethod) { methodPrefix = member.getContainingClass() instanceof PsiAnonymousClass ? "" : "$" + member.getName(); } else if (member instanceof PsiField && member.getContainingClass() instanceof PsiAnonymousClass) { methodPrefix = ""; } else { //inside class initializer everywhere or field in a named class methodPrefix = "$new"; } return methodPrefix; }