private static boolean methodCallExpressionDefinitelyRecurses(
      GrMethodCallExpression exp, GrMethod method) {
    final GrExpression invoked = exp.getInvokedExpression();
    if (invoked instanceof GrReferenceExpression methodExpression) {
      final PsiMethod referencedMethod = exp.resolveMethod();
      if (referencedMethod == null) {
        return false;
      }
      final GrExpression qualifier =
          methodExpression.getQualifierExpression();
      if (referencedMethod.equals(method)) {
        if (method.hasModifierProperty(PsiModifier.STATIC) ||
            method.hasModifierProperty(PsiModifier.PRIVATE)) {
          return true;
        }
        if (qualifier == null || qualifier instanceof GrReferenceExpression && PsiUtil.isThisReference(qualifier)) {
          return true;
        }
      }
      if (expressionDefinitelyRecurses(qualifier, method)) {
        return true;
      }
    }
    return callExpressionDefinitelyRecurses(exp, method);
  }
private static boolean methodCallExpressionDefinitelyRecurses(
      GrMethodCallExpression exp, GrMethod method)