@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) {
      if (element instanceof PsiNewExpression newExpression) {
        final PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass();
        if (anonymousClass == null) return;
        final PsiMethod[] methods = anonymousClass.getMethods();
        if (methods.length != 1) return;

        final PsiParameter[] parameters = methods[0].getParameterList().getParameters();
        final PsiType functionalInterfaceType = anonymousClass.getBaseClassType();
        MethodReferenceCandidate methodRefCandidate =
          LambdaCanBeMethodReferenceInspection.extractMethodReferenceCandidateExpression(methods[0].getBody());
        if (methodRefCandidate == null) return;
        final PsiExpression candidate = LambdaCanBeMethodReferenceInspection
          .canBeMethodReferenceProblem(parameters, functionalInterfaceType, anonymousClass.getParent(), methodRefCandidate.myExpression);

        final String methodRefText =
          LambdaCanBeMethodReferenceInspection.createMethodReferenceText(candidate, functionalInterfaceType, parameters);

        replaceWithMethodReference(project, methodRefText, anonymousClass.getBaseClassType(), anonymousClass.getParent());
      }
    }
@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater)