public static PsiMethod getDelegatedMethod(PsiMethod method) {
    final PsiCodeBlock body = method.getBody();
    assert body != null;
    final PsiStatement[] statements = body.getStatements();
    final PsiStatement statement = statements[0];
    if (statement instanceof PsiReturnStatement) {
      final PsiExpression returnValue = ((PsiReturnStatement)statement).getReturnValue();
      final PsiMethodCallExpression call = (PsiMethodCallExpression)returnValue;
      assert call != null;
      return call.resolveMethod();
    }
    else {
      final PsiExpression value = ((PsiExpressionStatement)statement).getExpression();
      final PsiMethodCallExpression call = (PsiMethodCallExpression)value;
      return call.resolveMethod();
    }
  }
public static PsiMethod getDelegatedMethod(PsiMethod method)