void (final @NotNull PsiAnonymousClass aClass) { if (AnonymousCanBeLambdaInspection.canBeConvertedToLambda(aClass, false, Collections.emptySet())) { final PsiNewExpression newExpression = ObjectUtils.tryCast(aClass.getParent(), PsiNewExpression.class); Problem problem = doCheckMethodCallOnFunctionalExpression(call -> { final PsiMethod method = aClass.getMethods()[0]; final PsiCodeBlock body = method.getBody(); final PsiReturnStatement[] returnStatements = PsiUtil.findReturnStatements(body); if (returnStatements.length > 1) { return false; } final PsiElement callParent = PsiUtil.skipParenthesizedExprUp(call.getParent()); return callParent instanceof PsiStatement || callParent instanceof PsiLocalVariable; }, newExpression, aClass.getBaseClassType(), new ReplaceAnonymousWithLambdaBodyFix()); if (problem != null) { problem.register(holder); } } }