void (MethodReferenceUsageInfo usage) { PsiMethodReferenceExpression expression = usage.getExpression(); if (usage.isApplicableBySecondSearch()) { PsiExpression qualifierExpression = expression.getQualifierExpression(); LOG.assertTrue(qualifierExpression != null); PsiElementFactory factory = JavaPsiFacade.getElementFactory(myProject); PsiElement qualifier; if (myTargetParameter != null) { qualifier = factory.createReferenceExpression(myTargetClass); } else { boolean thisAccess = thisAccessExpressionApplicable(expression); qualifier = thisAccess ? factory.createExpressionFromText("this", qualifierExpression) : createSyntheticAccessExpression(factory, expression); } qualifierExpression.replace(qualifier); } else { PsiLambdaExpression lambdaExpression = LambdaRefactoringUtil.convertMethodReferenceToLambda(expression, false, true); List<PsiExpression> returnExpressions = LambdaUtil.getReturnExpressions(lambdaExpression); if (!returnExpressions.isEmpty()) { PsiMethodCallExpression methodCall = (PsiMethodCallExpression)returnExpressions.get(0); processMethodCall(methodCall); usage.setReplacement(methodCall); } } }