PsiExpression (PsiElement element) { if (myMethodCall == null || !myMethodCall.isValid()) { return myExpression == null || !myExpression.isValid() ? null : myExpression; } if (element == null) return null; final PsiMethod method = myMethodCall.resolveMethod(); if (method != null) { return checkMethod(element, method); } else if (myMethodCall instanceof PsiMethodCallExpression){ final Collection<PsiElement> psiElements = TargetElementUtil.getInstance() .getTargetCandidates(((PsiMethodCallExpression)myMethodCall).getMethodExpression()); for (PsiElement psiElement : psiElements) { if (psiElement instanceof PsiMethod) { final PsiExpression expression = checkMethod(element, (PsiMethod)psiElement); if (expression != null) return expression; } } } return null; }